akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<utility>
#include<algorithm>
#include<unordered_map>
#include <cmath>
#include<climits>
using namespace std;

int main()
{
    long long n; cin >> n;
    long long q; cin >> q;
    string s; cin >> s;
    vector<long long> ls(q);
    vector<long long> rs(q);
    for(int i = 0; i < q; ++i){
        cin >> ls[i];
        cin >> rs[i];
    }

    vector<long long> ac_num(n);
    for(int i = 0; i < n - 1; ++i){
        if( (s[i] == 'A') && (s[i + 1] == 'C') ){
            ac_num[i + 1] = ac_num[i] + 1;
        }
        else{
            ac_num[i + 1] = ac_num[i];
        }
    }

    for(int i = 0; i < q; ++i){
        long long answer = ac_num[ rs[i] - 1 ] - ac_num[ ls[i] - 1 ];
        cout << answer << endl;
    }  
    return 0;
}


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

using namespace std;
const int N =309;
double dp[N][N][N] ;
int n, a[N], cnt[5] ;

double Dp(int i, int j, int k)
{

    int sushi = i+j+k;
    if(i < 0 || j < 0 || k < 0) return 0.0;
    if(!sushi)
        return 0.0;
    double &ret = dp[i][j][k] ;
    if(ret == ret)
        return ret;
    double pi = i*1.0 / sushi  ;
    double pj = j*1.0 / sushi  ;
    double pk = k*1.0 / sushi  ;
    double pw = n*1.0 / sushi  ;
    ret =0.0 ;
    ret += pw + pi*Dp(i-1 , j , k) + pj*Dp(i+1 , j-1 , k) + pk*Dp(i , j+1 , k-1) ;
    return ret ;

}
int main()
{
    cout << fixed <<  setprecision(9);
    cin >> n ;
    for(int i=0; i<n; i++)
        cin >> a[i], cnt[a[i]]++;
    memset(dp , -1 , sizeof dp) ;
    cout << Dp(cnt[1], cnt[2], cnt[3]) ;
    return 0;
}


Measured memory_bytes: 230784
/*
Author : Xinyuan
*/
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define INF 1000000007
#define mod 1005
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef long long int  ll;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int nxt() {int x;scanf("%d", &x);return x;}


int main(){
    int x = nxt();
    for (int i = 1; i < sqrt(x) + 1; i+=1){
        if(x % i != 0) continue;
        for(int a = -10000; a < 10000; a++){
            int b = i + a;
            //if(pow(a,4) + pow(a,3)*b + pow(a,2)*pow(b,2) + a*pow(b,3) + pow(b, 4) > x/i) goto next;
            if(pow(a,4) + pow(a,3)*b + pow(a,2)*pow(b,2) + a*pow(b,3) + pow(b, 4) == x/i){
                printf("%d %d", b, a);
                return 0;
            }
        }
        next:;
    }
    return 0;
}

// a5 – b5 = (a – b)(a4 + a3b + a2b2 + ab3 + b4)

Measured memory_bytes: 4304
import sys;
input = sys.stdin.readline

n = int(input())
d = [int(x) for x in input().split()]

def doit():
  if n >= 24:
    return 0
  if n == 1:
    return d[0]
  
  res = [0] * 13
  for x in d:
    if x == 0:
      return 0
    res[x] += 1;
    if x == 12:
      if res[x] == 2:
        return 0
    if res[x] == 3:
      return 0
  
  ban = [False] * 24
  mm = 12
  flip = False
  prev = [0, 24]
  for i, x in enumerate(res):
    diff = 12
    if x == 2:
      ban[i] = ban[24 - i] = True
      diff = i - prev[0]
      prev[0] = i
      prev[1] = 24 - i
      print("x2", i, diff, file=sys.stderr)
      flip = not flip
    if x == 1:
      if flip:
        ban[i] = True
        diff = i - prev[0]
        prev[0] = i
      else:
        ban[24 - i] = True
        diff = prev[1] - (24 - i)
        prev[1] = 24 - i
      flip = not flip
      print("x1", i, diff, file=sys.stderr)
    if diff < mm:
      mm = diff
      print(mm, file=sys.stderr)
  #last = abs(prev[1] - prev[0])
  last = prev[1] - prev[0]
  print("last", prev[0], prev[1], file=sys.stderr)
  if last < mm:
    return last
  return mm


print(doit())


Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

int main(void) {
    int a, b, c;
    cin >> a >> b >> c;
    vector<int> vec;
    vec.push_back(a);
    vec.push_back(b);
    vec.push_back(c);

    sort(vec.begin(), vec.end());
    
    ostringstream answer;
    for (auto itr = vec.begin(); itr != vec.end(); ++itr) {
        if (answer.str() != "") {
            answer << ' ';
        }
        
        answer << *itr;
    }
    
    cout << answer.str() << endl;

    return 0;
}

Measured memory_bytes: 3224
#pragma GCC diagnostic error "-std=c++14"
#pragma GCC target("avx")
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#include<cstdio>
#include<cctype>
using namespace std;
template <class code>inline code read(const code &a)
{
    code x=0;short w=0;char ch=0;
    while(!isdigit(ch)) {w|=ch=='-';ch=getchar();}
    while(isdigit(ch)) {x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
    return w?-x:x;
}
void print(int x){
	if(x<0)putchar('-'),x=-x;
	if(x>=10)print(x/10);
	putchar(x%10+48);
}
int main()
{
	int n=read(n),m=read(m);
	while(m--){
		int x=read(x);
		n-=x;
		if(n<0){
			puts("-1");
			return 0;
		}
	}	
	printf("%d\n",n);
	return 0;
}



Measured memory_bytes: 1600
#include <bits/stdc++.h>
using namespace std;
int a[3][3],n,b,c[3],d[3];
int main()
{
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin>>a[i][j];
        }
    }
    cin>>n;
    int cnt1=0,cnt2=0;
    for(int i=0;i<n;i++){
        cin>>b;
        for(int j=0;j<3;j++){
              for(int k=0;k<3;k++){
                  if(b==a[j][k]){
                      c[j]++,d[k]++;
                      if(j==k) cnt1++;
                      if((j==0&&k==2)||(j==1&&k==1)||(j==2&&k==0)) cnt2++;
                  }
              }
        }
    }
    for(int i=0;i<3;i++){
        if(c[i]==3||d[i]==3){
            cout<<"Yes";
            return 0;
        }
    }
   if(cnt1==3||cnt2==3){
       cout<<"Yes";
       return 0;
   }
    cout<<"No";
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

class residence(object):
	def __init__(self):
		one = [0] * 10
		two = [0] * 10
		three = [0] * 10
		self.all = [one, two, three]

residences = [ ]

for i in xrange(4):
	residences.append(residence())

n = int(raw_input())

for i in xrange(n):
	b, f, r, v = map(int, raw_input().split())
	residences[b-1].all[f-1][r-1] += v

for i, residence in enumerate(residences):
	for floor in residence.all:
		print '',
		for index, num in enumerate(floor):
			if index == len(floor) - 1:
				print num
			else:
				print num,
	if i != len(residences) - 1:
		print '####################'

Measured memory_bytes: 4248
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define RRep(i, r, n) for (ll i = n - 1; i <= r; i--)
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define int long long
#define pb push_back
#define mp make_pair
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const int MOD = (1000000007);
//const int MOD = (998244353);
//const int INF = (1 << 30)-1;
const int INF = (1LL << 60)-1;
const double EPS = (1 >> 30);

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

using Graph = vector<vector<pair<int, int>>>;
using Ki = vector<vector<int>>;
using Vi = vector<int>;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    
    int a,b,k;
    cin>>a>>b>>k;
    if(a>=k){
        cout<<a-k<<" "<<b<<endl;
    }
    else if(a+b>=k){
        cout<<0<<" "<<a+b-k<<endl;
    }
    else{
        cout<<0<<" "<<0<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
    // Your code here!
    ll n,sum=0;
    cin>>n;
    int s[n];
    for(int i=0;i<n;i++){
        cin>>s[i];
        sum+=s[i];
    }
    ll a=sum-2*s[0];
    ll ans=abs(a);
    for(int i=1;i<n-1;i++){
        a-=2*s[i];
        ans=min(ans,abs(a));
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>

int main() {
  int N, X, sum=0, min=1000, cur;
  std::cin >> N >> X;
  for (int i=0; i<N; i++) {
    std::cin >> cur;
    if (cur <= min) min = cur;
    sum += cur;
  }

  std::cout << (X-sum)/min + N << std::endl;

  return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::str::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::cmp::{min,max};

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

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:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let cin = stdin();
    let cin = cin.lock();
    let s: String = cin 
        .bytes() // Bytes
        .map(|c| c.expect("failed reading char") as char)
        .skip_while(|c| c.is_whitespace()) // c が whitespace である限り skip
        .take_while(|c| !c.is_whitespace()) // c が whitespace でない限り要素を返す
        .collect();
    s.parse().ok().expect("failed parsing")
}

fn main() {
    input! {
        a:usize,
        b:usize
    }
    println!("{}", (a as f32)/(b as f32));
}


Measured memory_bytes: 4352
import copy
N,M=map(int,input().split())
ans={}
for i in range(M):
    p,S=map(str,input().split())
    ans.setdefault(p,[]).append(S)

ac=0
wa=0

for i in ans.keys():
    wa_count=0
    for j in ans[i]:
        if j=="WA":
            wa_count+=1
        elif j=="AC":
            ac+=1
            wa+=wa_count
            break
print(ac,wa)

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

using namespace std;
long long a[10001];
long long x;
int main(){
    cin >> x;
    long long n = pow(1e12,1.0/5);
    for (long long i = 1; i <= n; i++) a[i] = i*i*i*i*i;
    for (long long i = n + 1; i <= 2*n; i++){
        long long temp = i - n;
        a[i] = - (temp*temp*temp*temp*temp);
    }
    long long p , q;
    for (int i = 0; i <= 2*n; i++)
        for (int j = 0; j <= 2*n; j++)
            if (a[i] - a[j] == x){
                p = ((i <= n) ? i : -(i - n)) , q = ((j <= n) ? j : -(j - n));
                //cout << p << " " << q << "\n";
            }
    cout << p << " " << q;
    return 0;
}

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

#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}

int N,M,K;

int val;

void dfs(int n,int sum){
    if(n==N){
        if(sum>K)val+=sum-K;
        else val++;
        return;
    }
    reps(i,1,M+1)dfs(n+1,sum+i);
}

void solve(){
    if(M==1){
        if(N>K)printf("%.20f\n",1.0*N);
        else printf("%.20f\n",1.0);
        return;
    }
    val=0;
    dfs(0,0);
    int piyo=1;
    rep(i,N)piyo*=M;
    printf("%.20f\n",1.0*val/piyo);
}

signed main(){
    while(cin>>N>>M>>K,N||M||K)solve();
    return 0;
}

Measured memory_bytes: 2980
#138-e
from collections import defaultdict
import bisect

s = input()
t = input()
n = len(s)
m = len(t)

ans=0
pos=-1

d = defaultdict(list)
for i in range(n):
    if s[i] in t:
        d[s[i]].append(i)
        
for i in range(n):
    if s[i] in t:
        d[s[i]].append(i+n)
        
for v in t:
    l = d[v]
    ind = bisect.bisect_right(l, pos)
    if l:
        ans += l[ind]-pos
        if l[ind]<n:
            pos = l[ind]
        else:
            pos = l[ind] - n
    else:
        ans = -1
        break
        
print(ans)
        



Measured memory_bytes: 12148
#include <sstream>
#include <fstream>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <string>
#include <queue>
#include <bitset>
using namespace std;

#define int long long
#define FOR(i, a, b) for (int i = (a), _##i = (b); i <= _##i; ++i)
#define FORD(i, a, b) for (int i = (a), _##i = (b); i >= _##i; --i)
#define REP(i, a) for (int i = 0, _##i = (a); i < _##i; ++i)
#define REPD(i,n) for(int i = (n)-1; i >= 0; --i)

#define DEBUG(X) { cerr << #X << " = " << (X) << endl; }
#define PR(A, n) { cerr << #A << " = "; FOR(_, 1, n) cerr << A[_] << ' '; cerr << endl; }
#define PR0(A, n) { cerr << #A << " = "; REP(_, n) cerr << A[_] << ' '; cerr << endl; }

#define sqr(x) ((x) * (x))
#define ll long long
#define double long double
typedef pair<int, int> II;
#define PI (2 * acos((double)0))
#define __builtin_popcount __builtin_popcountll
#define SZ(x) ((int)(x).size())
#define ALL(a) (a).begin(), (a).end()
#define MS(a,x) memset(a, x, sizeof(a))
#define next ackjalscjaowjico
#define prev ajcsoua0wucckjsl
#define y1 alkscj9u20cjeijc
#define left lajcljascjljl
#define right aucouasocjolkjl
#define y0 u9cqu3jioajc

#define TWO(X) (1LL<<(X))
#define CONTAIN(S,X) ((S) & TWO(X))

double safe_sqrt(double x) { return sqrt(max((double)0.0, x)); }
int GI(int& x) { return scanf("%lld", &x); }

vector<int> get(int need) {
    vector<int> res;
    if (need == 1) {
        return res;
    }

    if (need % 2 == 0) {
        res = get(need / 2);
        int t = SZ(res) + 1;
        res.push_back(t);
        return res;
    }

    res = get(need - 1);
    int t = SZ(res) + 1;
    res.insert(res.begin(), t);
    return res;
}

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout << (fixed) << setprecision(9) << boolalpha;

    int need;
    while (cin >> need) {
        auto res = get(need + 1);
        int t = SZ(res);
        FOR(i,1,t) res.push_back(i);

        cout << SZ(res) << endl;
        for(int x : res) cout << x << ' '; cout << endl;
    }
    return 0;
}


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

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


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include<math.h>

int main()
{
  int N;
  scanf("%d",&N);
  int a[6];
  for(int i=4;i>=1;i--)
  {
  	a[i]=N%10;
  	N=N/10;
  }
  if(a[1]==a[2]&&a[2]==a[3])
  printf("Yes");
  else if(a[2]==a[3]&&a[3]==a[4])
  printf("Yes");  
  else
printf("No");
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;

int main()
{
    cin >> N;
    
    cout << N*2*3.141592653589;
    return 0;
}

Measured memory_bytes: 3800
S = input()
length = len(S)

ans = 0
for i in range(length):
    s_ = S[i:]
    for j in range(length, -1, -1):
        # print(s[:-j])
        if j == 0:
            s = s_
        else:
            s = s_[:-j]

        valid = True
        for x in s:
            if x not in ['A', 'C', 'G', 'T']:
                valid = False
                break
        if valid:
            ans = max(ans, len(s))

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF    	((ll)1ll<<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007ll)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			3.1415926535897932384

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}
void OUT(bool b){cout<<(b?"YES":"NO")<<endl;}
void Out(bool b){cout<<(b?"Yes":"No")<<endl;}
void out(bool b){cout<<(b?"yes":"no")<<endl;}
int popcnt(int x) { return __builtin_popcount(x); }
int popcnt(ll x) { return __builtin_popcountll(x); }
int clz(int x) { return 31 - __builtin_clz(x); }
int clz(ll x) { return 63 - __builtin_clzll(x); }
int ctz(int x) { return __builtin_ctz(x); }
int ctz(ll x) { return __builtin_ctzll(x); }

class compare {
public:
	bool operator()(tuple<ll, ll> a, tuple<ll, ll> b) {
		return (get<1>(a) > get<1>(b));
	}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,p;
	ll ans=1;
	cin>>n>>p;
	map<ll,ll> mp;
	if(n==1){
		cout<<p<<endl;
		return 0;
	}
	range(i,2,p+1){
		ll t=1;
		rep(j,n){
			t*=i;
			if(t>p){
				cout<<ans<<endl;
				return 0;
			}
		}
		if(p%t==0)ans=i;
	}
	cout<<ans<<endl;
}

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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

const int N = 3e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;

int n, Q;
int arr[N + 2];
inline int mul(int a, int b) { return (1ll * a * b) % M; };
inline int add(int a, int b)
{
	if ( a + b < 0 ) return a + b + M;
	if ( a + b >= M) return a + b - M;
	return a + b;
}

int pwrmod(int a, int b)
{
	int res = 1;
	while (b )
	{
		if (b & 1) res = (1ll * res * a) % M;
		a = (1ll * a * a) % M;
		b >>= 1;
	}
	return res;
}

int fact[N + 2], ifact[N + 2];
void allfact()
{
	fact[0] = 1; for (int i = 1; i <= N; i++) fact[i] = mul(i, fact[i - 1]);
	ifact[N] = pwrmod(fact[N], M - 2); for (int i = N - 1; i >= 0; i--) ifact[i] = mul(ifact[i + 1], i + 1);
}

int ncr(int n1, int r1) { if ( n1 < r1 ) return 0; return mul( mul(fact[n1], ifact[r1]), ifact[n1 - r1]);}



void solve()
{
	allfact();
	int k; cin >> k; string str; cin >> str; n = str.size();

	int ans = 0;
	lop(i, n, (k + n + 1))
	{
		ans = add(ans, mul(ncr(k + n, i), pwrmod(25, k + n - i)));
	}

	cout << ans << endl;

}

int32_t main()
{
	ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);

	int test = 1;
	// cin >> test;
	while (test--)solve();


}





Measured memory_bytes: 51028
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner ipt = new Scanner(System.in);
		int n = ipt.nextInt(), tmp = 0, max = 0;
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ipt.nextInt();
		for (int i = 0; i < n - 1; i++) {
			if (a[i] >= a[i + 1])
				tmp++;
			else {
				if (max < tmp)
					max = tmp;
				tmp = 0;
			}
			if (max < tmp)
				max = tmp;
		}
		System.out.println(max);
		ipt.close();
	}
}

Measured memory_bytes: 51908
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	int a, b;
	string s;
	cin >> a >> b >> s;
	for (int i = 0; i < a; i++) {
		if (s[i] =='-') {
			cout << "No" << endl;
			return 0;
		}
	}
	if (s[a] != '-') {
		cout << "No" << endl;
		return 0;
	}
	for (int i = a + 1; i < a + b + 1; i++) {
		if (s[i] =='-') {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

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


N=int(input())
B=[tuple(map(int,input().split())) for i in range(N)]

if N==1:
    print(1)
    sys.exit()

PQ=set()

for i in range(N-1):
    x1,y1=B[i]
    for j in range(i+1,N):
        x2,y2=B[j]

        u,v=x2-x1,y2-y1

        PQ.add((u,v))

def find(x):#find(a)=find(b)のとき同じグループ
    while Group[x] != x:
        x=Group[x]
    return x

def Union(x,y):  # xとyが同じグループになるよう更新
    if find(x) != find(y):
        Group[find(y)]=Group[find(x)]=min(find(y),find(x))
ANS=50

for p,q in PQ:

    Group=[i for i in range(N)]#グループ分け.Group[i]=jのときiとjは同じグループ

    for i in range(N-1):
        for j in range(i+1,N):
            if B[i][0]+p==B[j][0] and B[i][1]+q==B[j][1]:
                Union(i,j)
            if B[i][0]-p==B[j][0] and B[i][1]-q==B[j][1]:
                Union(i,j)

    G2=[find(i) for i in range(N)]
    ANS=min(ANS,len(set(G2)))

print(ANS)
        


Measured memory_bytes: 46828
#include <iostream>
#include <string>
#include <vector>
#include <stdlib.h>
#include <cstdint>
using namespace std;

long long s(long long x)
{
    long long ret = 0;
    while (x > 0) {
        ret += x % 10;
        x /= 10;
    }
    return ret;
}

bool compare( long long x, long long y )
{
	return (double)x / s(x) < (double)y / s(y);
}

int main()
{
	long long k;

	cin >> k;

	long long d = 1, cur = 0;
	for( int i = 0; i < k; i++ ) {
		long long x = cur + d;
		long long y = cur + d * 10;
		if (compare(x, y)) {
            cur = x;
        }
		else {
            cur = y;
            d *= 10;
        }
        cout << cur << endl;
    }

	return 0;
}


Measured memory_bytes: 256
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n,k=n1()
tmp=n3(k*2)
d=tmp[::2]
A=tmp[1::2]

a=[]
for line in A:
    a.extend(line)
print(n-len(set(a)))

Measured memory_bytes: 9380
#include<iostream>
using namespace std;
int main()
{
int a,b;
char c;
int cong=0,tru=0,nhan=0;
double chia;
for(int i=1;;i++){
cin>>a>>c>>b;
if(c == '?') break;
if(c == '+'){ cong = a + b ;cout<<cong<<endl;}
else if(c == '-'){tru = a - b;cout<<tru<<endl;}
else if(c == '*'){nhan = a * b;cout<<nhan<<endl;}
else if(c == '/'){chia = a / b;cout<<chia<<endl;}
}
return 0;
}

Measured memory_bytes: 3264
#include <cstdio>
#include <string>

using namespace std;

int main()
{
  char s[50];
  char t[50];
  scanf("%s", s);

  int i = 0;
  int j = 0;
  while (i < 13){
    if (i == 4){
      t[i] = char(32);
      i++;
      continue;
    } else {
      t[i] = s[j];
    }
    i++;
    j++;
  }
  printf("%s\n", t);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <cstdlib>
#include <queue>
#include <cstdio>
using namespace std;

int main() {
    vector<char> S(3);
    vector<char> T(3);
    for(int i = 0; i<3; ++i){
        cin >> S.at(i);
    }
    for(int i = 0; i<3; ++i){
        cin >> T.at(i);
    }
    int count =0;
    for(int i = 0; i<3; ++i){
        if(S.at(i)==T.at(i)){
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define sz(v) (v).size()
#define debug(x) cerr << #x << "_=_" << x << "\n";
#define sum(n) ((n)*((n)+1)>>1)
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<pair<int, int>, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;

const int MAXN = 1e5+5;
int dp[MAXN], arr[MAXN];
int n, k;

int f(int i){
    if(i==0) return 0;
    if(i==1) return abs(arr[1]-arr[0]);
    if(~dp[i]) return dp[i];
    int ans = INT_MAX;
    for (int j=1; j<=k; j++){
        if(i-j>=0)
            ans = min(ans, f(i-j) + abs(arr[i-j]-arr[i]));
    }

    return dp[i] = ans;
}


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



    cin >> n >> k;
    for (int i=0; i<n; i++) cin >> arr[i];
    memset(dp, -1, sizeof dp);
    cout << f(n-1) << "\n";

    return 0;
}

/*
1
9 3
111100000
 */

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define ii pair <int , int>
#define is pair <int, string>
#define ll long long
#define mx 100000
#define sf scanf
#define sf(n) scanf("%d",&n)
#define pf printf
using namespace std;
vector <int> v;

/*int intConvert(string s){
    int n;
    stringstream geek(s);
    geek >> n;
    return n;
}*/

/*string strConvert(int n){
    string s;
    stringstream ss;
    ss << n;
    s=ss.str();
    return s;
}*/


int main(){
    string s,ss;
    cin>>s>>ss;

    s+=s;
    if(s.find(ss)== string::npos) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;

    return 0;
}



Measured memory_bytes: 3224
#include <bits/stdc++.h>
#define MOD 998244353
#define ll long long
#define ls(x) x<<1
#define rs(x) x<<1|1
ll ff[200100];
#define MAXN 200010
int x[200100],y[200100];
unsigned ll n,m,ans[MAXN<<2],tag[MAXN<<2];
using namespace std;

inline void push_up(ll p)
{
    ans[p]=ans[ls(p)]+ans[rs(p)];
}
void build(ll p,ll l,ll r)
{
    tag[p]=0;
    if(l==r)
    {
    	ans[p]=ff[l];return ;
    }
    ll mid=(l+r)>>1;
    build(ls(p),l,mid);
    build(rs(p),mid+1,r);
    push_up(p);
} 
inline void f(ll p,ll l,ll r,ll k)
{
    tag[p]=(tag[p]+k)%MOD;
    ans[p]=ans[p]%MOD+k%MOD*(r-l+1)%MOD;
}
inline void push_down(ll p,ll l,ll r)
{
    ll mid=(l+r)>>1;
    f(ls(p),l,mid,tag[p]);
    f(rs(p),mid+1,r,tag[p]);
    tag[p]=0;
}
inline void update(ll nl,ll nr,ll l,ll r,ll p,ll k)
{
    if(nl<=l&&r<=nr)
    {
        ans[p]+=(k*(r-l+1)%MOD);
        tag[p]+=k%MOD;
        return ;
    }
    push_down(p,l,r);
    ll mid=(l+r)>>1;
    if(nl<=mid)update(nl,nr,l,mid,ls(p),k);
    if(nr>mid) update(nl,nr,mid+1,r,rs(p),k);
    push_up(p);
}
ll query(ll q_x,ll q_y,ll l,ll r,ll p)
{
	if(q_x+q_y==0) return 0;
    ll res=0;
    if(q_x<=l&&r<=q_y)return ans[p];
    ll mid=(l+r)>>1;
    push_down(p,l,r);
    if(q_x<=mid)res+=query(q_x,q_y,l,mid,ls(p));
    if(q_y>mid) res+=query(q_x,q_y,mid+1,r,rs(p));
    return res;
}
int main()
{
	
	int n,m;
	cin>>n>>m;
	memset(ff,0,sizeof ff);
	ff[1] = 1;
	ff[0] = 0;
	build(1,1, n);
	for(int i=1;i<=m;i++)
	{
		int p,q;
		cin>>p>>q;
		x[i] = p,y[i] = q;
	}
	
	for(int i = 2;i<=n;i++)
	{
		for(int j = 1;j<=m;j++)
		{
			ll g = max(0,i-x[j]),yy=max(0,i-y[j]);
			ll ans = (query(yy,g,1,n,1))%MOD;
			update(i,i,1,n,1,ans);
		}
	}
	cout<<(query(n,n,1,n,1)%MOD);
	
	return 0;
}

Measured memory_bytes: 13392
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int P[3];
  cin >> P[0] >> P[1] >> P[2];
  int b[3];
  b[0]=P[0]+P[1];
  b[1]=P[1]+P[2];
  b[2]=P[0]+P[2];
  int a;
  a=min(b[0],min(b[1],b[2]));
  cout << a << endl;
}


Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]

A.sort()
B.sort()
C.sort()

i = 0
j = 0
ans = 0

for b in B:
    while i < N and A[i] < b:
        i += 1
    while j < N and C[j] <= b:
        j += 1
    ans += i * (N - j)

print(ans)

Measured memory_bytes: 23200
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
template <class T> vector<T> make_vec(size_t a, T val) {
    return vector<T>(a, val);
}
template <class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec(ts...))>(a, make_vec(ts...));
}
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
template <typename T> struct edge {
    int to;
    T cost;
    edge(int t, T c) : to(t), cost(c) {}
};
template <typename T> using WGraph = vector<vector<edge<T>>>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

map<ll, int> prime_factor(ll n) {
    map<ll, int> ret;
    for(ll i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1)
        ret[n] = 1;
    return ret;
}

ll power(ll x, ll n) {
    ll ret = 1;
    for(int i = 0; i < n; i++)
        ret *= x;
    return ret;
}

ll extgcd(ll a, ll b, ll &x, ll &y) {
    if(b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}

int main() {
    ll N;
    cin >> N;
    if(N == 1) {
        cout << 1 << endl;
        return 0;
    } else if(N == 2) {
        cout << 3 << endl;
        return 0;
    }
    auto factor = prime_factor(N);
    factor[2]++;
    vector<pll> bit;
    for(auto x : factor) {
        bit.pb(x);
    }
    int n = bit.size();
    ll res = LINF;
    for(int b = 0; b < (1 << n); b++) {
        ll k1 = 1, k2 = 1;
        for(int i = 0; i < n; i++) {
            if(b & (1 << i)) {
                k1 *= power(bit[i].first, bit[i].second);
            } else {
                k2 *= power(bit[i].first, bit[i].second);
            }
        }
        ll x, y;
        extgcd(k1, k2, x, y);
        if(x < 0) {
            res = min(k1 * (-x), res);
        } else if(y < 0) {
            res = min(k2 * (-y), res);
        } else
            continue;
    }
    cout << res << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;
const ll MOD=1e9+7;
ll dp[21][1<<21];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin>>N;
    int a[N][N];
    rep(i,0,N){
        rep(j,0,N){
            cin>>a[i][j];
        }
    }
    int comb=(1<<(N-1))-1;
    while(comb<1<<N){
        bool t=false;
        rep(j,0,N){
            if(!(comb&(1<<j))&&a[0][j]){
                t=true;
                break;
            }
        }
        if(t) dp[0][comb]=1;
        if(comb==0) break;
        int x=comb&-comb, y=comb+x;
        comb=((comb&~y)/x>>1)|y;
    }
    rep(i,1,N){
        int comb=(1<<(N-i-1))-1;
        while(comb<1<<N){
            rep(k,0,N){
                if(a[i][k]==1&&!(comb&(1<<k))){
                    dp[i][comb]+=dp[i-1][comb|(1<<k)];
                    dp[i][comb]%=MOD;
                }
            }
            if(comb==0) break;
            int x=comb&-comb, y=comb+x;
            comb=((comb&~y)/x>>1)|y;
        }
    }
    cout <<dp[N-1][0]<<"\n";
}

Measured memory_bytes: 307456
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
using namespace std;

struct Node{
  int key;
  Node *right,*left,*parent;
};

Node *root,*NIL;

Node * find(Node *u, int k){
  while(u!=NIL&&k!=u->key){
    if(k<u->key) u=u->left;
    else u=u->right;
  }
  return u;
}

void insert(int k){
  Node *y=NIL;
  Node *x=root;
  Node *z;

  z=(Node *)malloc(sizeof(Node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;

  while(x!=NIL){
    y=x;
    if(z->key<x->key){
      x=x->left;
    }else{
      x=x->right;
    }
  }

  z->parent=y;
  if(y==NIL){
    root=z;
  }else{
    if(z->key<y->key){
      y->left=z;
    }else{
      y->right=z;
    }
  }
}

void inorder(Node *u){
  if(u==NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(Node *u){
  if(u==NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n,i,x;
  string com;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    cin>>com;
    if(com[0]=='f'){
      scanf("%d",&x);
      Node *t=find(root,x);
      if(t!=NIL) printf("yes\n");
      else printf("no\n");
    }
    else if(com=="insert"){
      scanf("%d",&x);
      insert(x);
    }else if(com=="print"){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}



Measured memory_bytes: 22048
#include <bits/stdc++.h>
#define range(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) range(i, 0, a)
using namespace std;

typedef complex <double> P;

namespace std {
	bool operator < (const P& a, const P& b) {
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
	bool operator == (const P& a, const P& b) {
		return a.real()==b.real()&&a.imag()==b.imag();
	}
}

double dot( P a, P b ) {
    return real( conj( a ) * b );
}

double cross( P a, P b ) {
    return imag( conj( a ) * b );
}

struct C {
	P c;
    double r;
	C ( const P & c, double r ) : c( c ), r( r ) {}
};

struct L : public vector<P> {
    L ( const P & a, const P & b ) {
        push_back( a );
        push_back( b );
    }
};

P projection( L a, P p ) {
	double t = dot( p - a[0], a[0] - a[1] ) / norm( a[0] - a[1] );
	return a[0] + t * ( a[0] - a[1] );
}

P reflection( L a, P p ) {
	return p + 2.0 * ( projection( a, p ) - p );
}

L crosspointCL( C c, L l ) {
	P pr = projection( l, c.c );
	P e  = ( l[1] - l[0] ) / abs( l[1] - l[0] );
	double t = sqrt( c.r * c.r - norm( pr - c.c ) );
	P a = pr + t * e;
	P b = pr - t * e;
	if ( b < a ) swap( a, b );
	return L( a, b );
}

struct hoge {
    int hidarimuki;
    int migimuki;
};

int main() {
    int r, n;
    while ( cin >> r >> n, r ) {
        vector <int> left(n), right(n), hight(n);
        map <int, hoge> xToMaxHight;
        rep ( i, n ) {
            cin >> left[i] >> right[i] >> hight[i];
            range ( j, left[i], right[i] + 1 ) {
                if ( j == left[i] ) {
                    hoge tmp = xToMaxHight[j];
                    xToMaxHight[j] = { tmp.hidarimuki, max( tmp.migimuki, hight[i] ) };
                }
                else if ( j == right[i] ) {
                    hoge tmp = xToMaxHight[j];
                    xToMaxHight[j] = { max( hight[i], tmp.hidarimuki) , tmp.migimuki };
                }
                else {
                    hoge tmp = xToMaxHight[j];
                    xToMaxHight[j] = { max( hight[i], tmp.hidarimuki ) ,
                                       max( hight[i], tmp.migimuki ) };
                }
            }
        }

        C circle( P( 0, -r ), r );
        double ans = 1e9;
        range ( i, -r, r + 1 ) {
            P va;
            if ( i == -r ) {
                va = P( i, xToMaxHight[i].migimuki );
            }
            else if ( i == r ) {
                va = P( i, xToMaxHight[i].hidarimuki );
            }
            else {
                va = P( i, min( xToMaxHight[i].hidarimuki, xToMaxHight[i].migimuki ) );
            }
            L line( va , P( i, -1 ) );
            L tmp = crosspointCL( circle, line );

            ans = min( { ans, abs( va - tmp[0] ), abs( va - tmp[1] ) } );
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3300
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

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


	string A, B;
	cin >> A >> B;

	int kotae = 0;
	rep(i, 3) if (A[i] == B[i]) kotae++;

	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
using namespace std;


int main(){


    long long a,b,c=12,temp,p;
    while (scanf("%lld %lld",&a,&b)!=EOF)
    {
        c=12;

    if(a > b)
    {
        temp = a;
        a = b;
        b = temp;
    }
    p = a*b;
    while(c != 0)
    {
       c = a%b;
       a = b;
       b = c;
    }

    printf("%lld ",a);
    printf("%lld\n",p/a);
    }
    return 0;
}



Measured memory_bytes: 3136
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

def main():
    N = int(input())
    a = list(map(int, input().split()))
    L = [0]*(N+1)
    R = [0]*(N+1)
    for i in range(N):
        L[i+1] = L[i]^a[i]
        R[N-i-1] = R[N-i]^a[N-i-1]
    ans = [None]*N
    for i in range(N):
        ans[i] = L[i]^R[i+1]
    print(*ans)
    # print(L,R)


if __name__ == "__main__":
    main()

Measured memory_bytes: 110332
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	string s;
	cin >> s;
	int l=s.size();
	if(s[n]!='-')
	{
		printf("No\n");
		return 0;
	}
	for(int i=0;i<l;i++)
	{
		if(i==n)
			continue;
		if(!isdigit(s[i]))
		{
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    string s; cin>>s;
    vector<int> v(26,0);
    for(auto ch:s) v[ch-'a']=1;
    rep(i,26){
        if(v[i]==0){
            cout<<(char)('a'+i)<<endl;
            return 0;
        }
    }
    cout<<"None"<<endl;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
#include<stdint.h>
using namespace std;
#define IOS {cin.tie(0);ios_base::sync_with_stdio(false);}
#define N 300005
#define int int64_t

const double pi = acos(-1);

int32_t main(){
//	cout << atan2(1,1) << '\n';
//	cout << atan2(1,-1) << '\n';
//	cout << atan2(-1,-1) << '\n';
//	cout << atan2(-1,1) << '\n';
	//return 0;
	IOS;
	double x,y,t,o;
	cin >> x >> y >> t >> o;
	t = t*pi/180;
	o = o*pi/180;
	double l,r,d = hypot(x,y),orit = atan2(y,x);
	if(orit < 0) orit += 2*pi;
	double d1 = t - orit;
	if(d1 < 0) d1 += 2*pi;
	double d2 = orit - t;
	if(d2 < 0) d2 += 2*pi;
	l = 0, r = d;
	for(int i=0;i<100;i++){
		double m = (l+r) * 0.5;
		double deg2 = acos(m/d);
		double tmp = (d1<d2)?(t-(orit - deg2)):(orit+deg2-t);
		if(tmp > 2*pi) tmp -= 2*pi;
		if(tmp < 0) tmp += 2*pi;
		double tt = tmp/o; 
		double v1 = sqrt(d*d-m*m)/tt;
		double v2 = o*m;
		if(v1 < v2) r = m;
		else l = m;
	}
	double m = (l+r) * 0.5;
	double deg2 = acos(m/d);
	double tmp = orit + deg2 - t;
	if(tmp < 0) tmp += 2*pi;
	double tt = tmp/o;
	double v1 = sqrt(d*d-m*m)/tt;
	double v2 = o*m;
	cout << fixed << setprecision(12) << v2 << '\n';
	return 0;
}



Measured memory_bytes: 3704
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val s = in.readLine()

    out.println(
      if (s(2) == s(3) && s(4) == s(5)) {
        "Yes"
      } else {
        "No"
      }
    )

    out.flush()
  }
}


Measured memory_bytes: 25396
#include<bits/stdc++.h>
using namespace std;
using Int = long long;

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T>
vector<vector<T> > make_v(size_t a,size_t b){
  return vector<vector<T> >(a,make_v<T>(b));
}
template<typename T>
vector<vector<vector<T> > > make_v(size_t a,size_t b,size_t c){
  return vector<vector<vector<T> > > (a,make_v<T>(b,c));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//INSERT ABOVE HERE
signed main(){
  Int h,w,n;
  while(cin>>h>>w>>n,n){
    auto z=make_v<Int>(h,w);
    for(Int i=0;i<h;i++)
      for(Int j=0;j<w;j++)
	cin>>z[i][j];
    
    n--;
    auto dp=make_v<Int>(h+1,w+1);
    fill_v(dp,0);
    dp[0][0]=n;
    for(Int i=0;i<h;i++){
      for(Int j=0;j<w;j++){
	dp[i][j+1]+=(dp[i][j]+ z[i][j])/2;
	dp[i+1][j]+=(dp[i][j]+!z[i][j])/2;
	z[i][j]^=(dp[i][j]&1);
      }
    }
    Int y=0,x=0;
    while(y<h&&x<w){
      if(z[y][x]) x++;
      else y++;
    }
    cout<<y+1<<" "<<x+1<<endl;
  }
  return 0;
}



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

int main(){
  string S; cin >> S;
  bool n,s,w,e; n=s=w=e=false;
  for(int i=0;i<S.size();i++){
    char c=S.at(i);
    if(c=='N')
      n=true;
    else if(c=='S')
      s=true;
    else if(c=='W')
      w=true;
    else if(c=='E')
      e=true;
  }
  if(n==s&&w==e)
    cout << "Yes";
  else
    cout << "No";
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

struct UnionFind
{
	UnionFind(int n) : p(n, -1) {}
	int root(int u)
	{
		return p[u] < 0 ? u : p[u] = root(p[u]);
	}
	int size(int u)
	{
		return -p[root(u)];
	}
	bool same(int u, int v)
	{
		return root(u) == root(v);
	}
	void unite(int u, int v)
	{
		p[u] = v;
	}
	vector<int> p;
};

int main()
{
	cout << fixed << setprecision(10);
	int n, u, v;
	cin >> n >> u >> v;
	u--;
	v--;

	vector<vector<int>> connect(n);
	UnionFind tree(n);

	REP(i, n - 1)
	{
		int x, y;
		cin >> x >> y;
		x--;
		y--;
		connect[x].push_back(y);
		connect[y].push_back(x);
	}

	vector<int> dist(n, INF);

	queue<int> q;
	q.push(v);
	dist[v] = 0;
	while (q.size())
	{
		int pos = q.front();
		q.pop();

		for (auto& next : connect[pos])
		{
			if (dist[pos] + 1 < dist[next])
			{
				dist[next] = dist[pos] + 1;
				tree.unite(next, pos);
				q.push(next);
			}
		}

	}

	int parm = u;
	REP(i, (dist[u] - 1) / 2)
	{
		parm = tree.p[parm];
	}
	tree.p[parm] = -1;

	int len = 0;
	REP(i, n)
	{
		if (tree.same(i, u))
		{
			chmax(len, dist[i]);
		}
	}

	cout << (dist[parm] - 1) / 2 + (len - (dist[parm] + 1) / 2);

	return 0;
}

Measured memory_bytes: 6912
N = int(input())
S = input()

ans = [S[0]]
pre = S[0]
# i番目の文字がi-1番目と一緒でないなら，追加
for e in S[1:]:
    if e != pre:
        ans.append(e)
        pre = e

#print(ans)
print(len(ans))

Measured memory_bytes: 4056
#include"bits/stdc++.h"
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

const int INF = INT_MAX;

void Main(){
    int n, m, x;
    cin >> n >> m >> x;
    vi c(n);
    vvi a(n, vi(m));
    rep(i, n){
        cin >> c[i];
        rep(j, m) cin >> a[i][j];
    }
    
    vi US(m, 0);
    int price = 0;
    vector<bool> ok(n, false);
    int ans = INF;
    
    rep(bit, (1<<n)){
        US = vi(m, 0);
        price = 0;
        ok = vector<bool>(n, false);

        rep(i, n){
            if(bit & (1<<i)) {
                rep(j, m){
                    US[j] += a[i][j];
                    if(US[j] >= x) ok[j] = true;
                } 
                price += c[i];
            }
        }
        bool OK = true;
        rep(j, m){
            OK = OK & ok[j];    
        } 
        if(OK) ans = min(ans, price);
    }
    if(ans == INF) cout << -1 << endl;
    else cout << ans << endl;
    return;
}

int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 3664