akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;

int main(){

    long long X,Y,A,B,C,p[100010]={},q[100010]={},r[100010]={},red[100010]={},green[100010]={};

    cin>>X>>Y>>A>>B>>C;

    for(int i=0;i<A;i++){
        cin>>p[i];
    }

    for(int i=0;i<B;i++){
        cin>>q[i];
    }

    for(int i=0;i<C;i++){
        cin>>r[i];
    }

    sort(p,p+A,greater<int>());
    sort(q,q+B,greater<int>());
    sort(r,r+C,greater<int>());

    //暫定食べるやつ
    for(int i=0;i<X;i++){
        red[i]=p[i];
    }
    for(int i=0;i<Y;i++){
        green[i]=q[i];
    }
    int rindex=X-1;
    int gindex=Y-1;
    int nindex=0;

    int rmin,gmin,nmax;

    while(1){
        rmin=red[rindex];
        gmin=green[gindex];
        nmax=r[nindex];

        if(rmin<nmax||gmin<nmax){
            if(rmin<gmin){
                //rの最低とnの最大を交換
                red[rindex]=nmax;
                rindex--;
            }else{
                //gの最低とnの最大を交換;
                green[gindex]=nmax;
                gindex--;
            }
            //比較対象が次へ
            nindex++;
        }else{
            break;
        }
    }

    long long ans =0;
    for(int i=0;i<X;i++){
        ans+=red[i];
    }

    for(int i=0;i<Y;i++){
        ans+=green[i];
    }


    //暫定食べるやつ
    for(int i=0;i<X;i++){
        red[i]=p[i];
    }
    for(int i=0;i<Y;i++){
        green[i]=q[i];
    }
    rindex=X-1;
    gindex=Y-1;
    nindex=0;

    rmin,gmin,nmax;

    while(1){
        rmin=red[rindex];
        gmin=green[gindex];
        nmax=r[nindex];

        if(rmin<nmax||gmin<nmax){
            if(rmin<=gmin){
                //rの最低とnの最大を交換
                red[rindex]=nmax;
                rindex--;
            }else{
                //gの最低とnの最大を交換;
                green[gindex]=nmax;
                gindex--;
            }
            //比較対象が次へ
            nindex++;
        }else{
            break;
        }
    }

    long long ans2 =0;
    for(int i=0;i<X;i++){
        ans2+=red[i];
    }

    for(int i=0;i<Y;i++){
        ans2+=green[i];
    }

    ans=max(ans,ans2);

    cout << ans <<endl;

    return 0;
}


Measured memory_bytes: 4096
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <fstream>
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef map<int, int> mii;
typedef map<int, string> mis;
typedef map<string, int> msi;
typedef set<int> si;
typedef set<ll> sl;
typedef map<ll, ll> mll;
typedef queue<int> qi;
typedef queue<ii> qii;
typedef vector<string> vs;
typedef pair<ll, ll> iil;
typedef vector<iil> viil;
 
#define pb push_back
#define mp make_pair
#define rep(i, n) for (int i = 0 ; i < n ; i++)
#define INF 1000000000

ll MOD = 1000000007;
 
void solve() {
    int n, m, x;
    cin >> n >> m >> x;
    vi c(n);
    int mat[n][m];
    rep(i, n) {
        cin >> c[i];
        rep(j, m) {
            cin >> mat[i][j];
        }
    }
    int mxx = 1000000000;
    bool found = false;
    rep(i, (1 << n)) {
        int mx[m];
        int cst = 0;
        memset(mx, 0, sizeof mx);
        rep(j, n) {
            if ((1 << j) & i) {
                rep(k, m) {
                    //cout << mat[i][j] << endl;
                    mx[k] += mat[j][k];
                }
                cst += c[j];
            }
        }
        bool f = true;
        rep(j, m) {
            if (mx[j] < x) {
                f = false;
            }
        }
        if (f) {
            mxx = min(mxx, cst);
            found = true;
        }
    }
    if (found) {
        cout << mxx << endl;
    }
    else {
        cout << -1 << endl;
    }
}
 
void querySolve() {
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
}
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    solve();
    //querySolve();
}



Measured memory_bytes: 3656
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <vector>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n);
  copy_n(istream_iterator<int>(cin), n, a.begin());
  copy_n(istream_iterator<int>(cin), n, b.begin());
  copy_n(istream_iterator<int>(cin), n, c.begin());
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  sort(c.begin(), c.end());
  vector<int64_t> countsA(n + 1);
  iota(countsA.begin(), countsA.end(), 0);
  vector<int64_t> countsB(n + 1);
  for(int i = 1; i <= n; ++i){
    countsB[i] = countsA[lower_bound(a.begin(), a.end(), b[i - 1]) - a.begin()] + countsB[i - 1];
  }
  vector<int64_t> countsC(n + 1);
  for(int i = 1; i <= n; ++i){
    countsC[i] = countsB[lower_bound(b.begin(), b.end(), c[i - 1]) - b.begin()] + countsC[i - 1];
  }
  cout << countsC.back() << endl;
}


Measured memory_bytes: 3840
#include<bits/stdc++.h>
#define ll long long
#define loop(n) for(ll i = 0; i<n; i++)
#define sort(a) sort(a.rbegin(), a.rend())
using namespace std;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout<<setprecision(10);
    
    int n; cin>>n;
    vector<long double> p(n);
    loop(n) cin>>p[i];

    vector<vector<long double>> dp(n+1, vector<long double> (n+1, 0.0)); 
    dp[0][0]  = 1.0;
    for(int i = 1; i<=n; i++){
        for(int j = 0; j<=n; j++){
            if(j==0) dp[i][j] = dp[i-1][j]*(1-p[i-1]);
            else dp[i][j] = dp[i-1][j-1]*p[i-1] + dp[i-1][j]*(1-p[i-1]);
        }
    }

    long double ans = 0;
    for(int i =1 + n/2; i<=n; i++) ans += dp[n][i];
    cout<<ans<<"\n";
    return 0;
}

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

const int INFTY =2147483647;
int L[200000],R[200000];

void merge(int A[],int left,int mid,int right){
    int n1=mid-left;
    int n2=right-mid;
    for(int i=0;i<n1;i++) L[i]=A[left+i];
    for(int i=0;i<n2;i++) R[i]=A[mid+i];
    L[n1] =R[n2]=INFTY;
    int i=0,j=0;
    for(int p=left;p<right;p++){
        if(L[i]<=R[j]) A[p]=L[i++];
        else A[p]=R[j++];
    }
}

void sort(int A[],int left,int right){
    if(left+1<right){
        int mid=(left + right)/2;
        sort(A,left,mid);
        sort(A,mid,right);
        merge(A,left,mid,right);
    }
}

//sort(A,0,n)で使用
int main(){
    int n,p,q=0,min,max;
    long long ans=0;
    int d[2005];
    cin>>n;
    for(int i=0;i<n;i++)cin>>d[i];
    sort(d,0,n);
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            p=(n+j)/2;
            min=j;
            max=n-1;
            if(d[j+1]<d[i]+d[j]){
                while(p!=q ){
                    q=p;
                    if(d[p]<d[i]+d[j])min=p;
                    else max=p;
                    p=(max+min+1)/2;
                }
                while(d[p]>=d[i]+d[j]&&p>j) p--;
                while(d[p]<d[i]+d[j]&&p<n) p++;
                p--;
                ans+=p-j;
            }
        }
    }
    cout<<ans<<endl;
}

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

int main(){
    int N;
    vector<double> P[200];
    cin >> N;
    for(int i=0; i<N; i++){
        double x, y;
        cin >> x >> y;
        P[i] = {atan2(y, x), x, y};
    }
    sort(P, P+N);
    for(int i=0; i<N; i++) P[N+i] = P[i];

    double ans = 0;
    for(int l=0; l<N; l++) for(int r=l; r<l+N; r++){
        double x = 0, y = 0;
        for(int k=l; k<=r; k++){
            x += P[k][1];
            y += P[k][2];
        }
        ans = max(ans, sqrt(x*x + y*y));
    }
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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

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

int main() {
  int N;
  cin >> N;
  vector<ll> A(N + 1);
  rep(i, N + 1) cin >> A[i];
  vector<ll> B(N);
  rep(i, N) cin >> B[i];

  ll ans = 0;
  rep(i, N) {
    if (A[i] >= B[i]) {
      ans += B[i];
    } else {
      ans += A[i];
      ll next = min(B[i] - A[i], A[i + 1]);
      A[i + 1] -= next;
      ans += next;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
use std::collections::BTreeMap;

fn main() {
    let stdin = std::io::stdin();
    let n = {
        let mut buf = String::new();
        stdin.read_line(&mut buf).unwrap();
        buf.trim().parse::<u32>().unwrap()
    };
    let mut map = BTreeMap::new();
    for i in 1..(n+1) {
        let mut buf = String::new();
        stdin.read_line(&mut buf).unwrap();
        let mut r = buf.split_whitespace();
        let s = r.next().unwrap().to_string();
        let p = r.next().unwrap().parse::<u32>().unwrap();
        let hoge = {
            if !map.contains_key(&s) {
                map.insert(s.clone(), vec![]);
            }
            map.get_mut(&s).unwrap()
        };
        hoge.push((i, p));
    }
    let mut ks = map.keys().collect::<Vec<&String>>();
    ks.sort();
    for k in ks {
        let mut a = map[k].clone();
        a.sort_by(|x, y| y.1.partial_cmp(&x.1).unwrap());
        //println!("{}", k);
        for (i, _p) in a {
            println!("{}", i);
            //println!("{}({})", i, _p);
        }
    }
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};

typedef struct node *Node;
#define NIL NULL

Node root;

Node treeMaximam(Node x){

}

Node treeMinimun(Node x){

}

Node treeSearch(Node u,int k){

}

Node treeDelete(Node z){

}
void insert(int k){

  Node y=NIL;
  Node x=root;
  Node z;

  z=malloc(sizeof(struct 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;
  char com[20];
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s",com);
    if(com[0]=='i'){
    scanf("%d",&x);
    insert(x);
  }else if(com[0]=='p'){
    inorder(root);
    printf("\n");
    preorder(root);
    printf("\n");
  }
  }
  return 0;
}



Measured memory_bytes: 25176
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=4e5+10;
struct Node
{
	ll x,h;
}p[N];
ll n,d,a,sum,tmp[N];
bool Cmp(const Node& a,const Node& b)
{
	return a.x<b.x;
}
int main()
{
	scanf("%lld%lld%lld",&n,&d,&a);
	d=d*2+1;
	for (int i=1;i<=n;i++) scanf("%lld%lld",&p[i].x,&p[i].h);
	sort(p+1,p+1+n,Cmp);
	for (int i=1,j=1,now=0;i<=n;i++)
	{
		while (p[j+1].x<p[i].x+d&&j<n) j++;
		p[i].h-=now;
		if (p[i].h>=0) tmp[j]+=(p[i].h/a+(p[i].h%a!=0))*a, now+=(p[i].h/a+(p[i].h%a!=0))*a, sum+=p[i].h/a+(p[i].h%a!=0);
		now-=tmp[i];
	}
	printf("%lld\n",sum);
}

Measured memory_bytes: 7936
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{

    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int r = input[0];
            int D = input[1];
            int x = input[2];
            //ans = rx-d

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


        }
    }
}

    




Measured memory_bytes: 28156
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#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++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;

int main(){
    int a,b,c,d,e,f;cin>>a>>b>>c>>d>>e>>f;
    double Max=-1;
    int water,tmp,ans1,ans2;
    bool can;
    rep(i,f/(100*a)+1)for(int j=0;100*a*i+100*b*j<=f;j++){
        water=100*a*i+100*b*j;
        tmp=min(-water+f,e*water/100);
        can=false;
        for(int sugar=tmp;sugar>=0;sugar--){
            rep(k,sugar/c+1){
                if((sugar-c*k)%d==0){
                    can=true;
                    break;
                }
            }
            if(can&&Max<(double)sugar/(double)(water+sugar)){
                Max=(double)sugar/(double)(water+sugar);
                ans1=water+sugar;
                ans2=sugar;
                break;
            }
        }
    }
    cout<<ans1<<" "<<ans2<<endl;
}

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


int main(){
int  a , b, c;
cin >> a>> b >> c;
cout << max(max (a*10+b+c,a+b*10+c),a+b+c*10)<< endl;
}

Measured memory_bytes: 256
from operator import itemgetter
N = int(input())
L = []
for i in range(N):
    L.append(list(map(int,input().split())))
L.sort(key=itemgetter(1))
flag = 0
sum = 0
for i in range(N):
    sum = sum + L[i][0]
    if sum > L[i][1]:
        flag = 1
        break
if flag == 1:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 53720
#include<iostream>
#include<cstring>
using namespace std;
const int BUF = 100005;


int K;
int R, S, P;
string str;

void read() {
    int dummy;
    cin >> dummy >> K;
    cin >> R >> S >> P;
    cin >> str;
}


int rec(int idx, int last, int dp[BUF][3]) {
    if (idx >= str.size()) return 0;
    int &ret = dp[idx][last];
    if (ret >= 0) return ret;
    ret = 0;
    for (int i = 0; i < 3; ++i) {
        if (last == i) continue;
        int toAdd = 0;
        if (i == 0 && str[idx] == 's') toAdd = R;
        if (i == 1 && str[idx] == 'r') toAdd = P;
        if (i == 2 && str[idx] == 'p') toAdd = S;
        ret = max(ret, rec(idx + K, i, dp) + toAdd);
    }
    return ret;
}

void work() {
    int ans = 0;
    int dp[BUF][3];
    memset(dp, -1, sizeof(dp));
    for (int i = 0; i < K; ++i) {
        ans += max(rec(i, 0, dp), max(rec(i, 1, dp), rec(i, 2, dp)));
    }
    cout << ans << endl;
}


int main() {
    read();
    work();
    return 0;
}


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

int main() {
  int N, L, ans;
  cin >> N >> L;
  if (L >= 0) {
    ans = (N-1) * (2*L + N) / 2;
  } else if (N+L-1 >= 0) {
    ans = N * (2*L + N - 1) / 2;
  } else {
    ans = (N-1) * (2*L + N -2) / 2;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
// Author : Syed Mujtaba
// Seek knowledge from the Cradle to the Grave !!
// https://www.linkedin.com/in/syed-mujtaba-064a5016a 

#include <bits/stdc++.h>
using namespace std;
#define int     long long
#define fast_io ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod ((int)(1e9 + 7))
signed main()
{
	fast_io
	int n, k;
	cin >> n >> k;
	int a[n + 1];
	int dp[n + 1][k + 1];
	vector < int > psa(n + 1, 0);
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	for(int i = 1; i <= n; i++)
	{
		psa[i] = a[i] + psa[i - 1];
	}
	vector < int > ps[n + 4];
	for(int i = 0; i <= n; i++)
	{
		ps[i].resize(k + 4);
		for(int j = 0; j <= k; j++)
			ps[i][j] = 0;
	}
	for(int i = 0; i <= k; i++)
	{
		if(i <= a[1])
			dp[1][i] = 1;
		else
			dp[1][i] = 0;
		ps[1][i+1] = (ps[1][i]%mod + dp[1][i]%mod)%mod;
	}
	for(int i = 2; i <= n; i++)
	{
		dp[i][0] = 1;
		ps[i][1] = 1;
		for(int j = 1; j <= k; j++)
		{
			dp[i][j] = 0;
			dp[i][j] = (mod + ps[i - 1][j + 1]%mod - ps[i - 1][max(0LL, j - a[i])]%mod)%mod;
			ps[i][j + 1] = (ps[i][j]%mod + dp[i][j]%mod)%mod;
		}
	}
	cout << dp[n][k] << endl;
}	

Measured memory_bytes: 157568
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    string S;
    cin >> S;

    map<char, int> mp;
    bool res = true;
    rep(i, S.size()) {
        mp[S[i]]++;
        if(mp[S[i]] >= 2) res = false;
    }

    if(res) cout << "yes" << endl;
    else cout << "no" << endl;

    return 0;
}

Measured memory_bytes: 256
package main

import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
  "sort"
)

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntVec(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}

func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}

type Area [][]int
func (A Area) Len() int { return len(A) }
func (A Area) Less(i, j int) bool { return A[i][1] - A[i][0] < A[j][1] - A[j][0] }
func (A Area) Swap(i, j int) { A[i], A[j] = A[j], A[i] }

type BinaryIndexedTree []int
func (BIT BinaryIndexedTree) Get(idx int) int {
  b := 0
  for i := idx; 0 < i; i -= i & (-i) {
    b += BIT[i]
  }
  return b
}
func (BIT *BinaryIndexedTree) Update(idx, v int) {
  N := len((*BIT))
  d := v - BIT.Get(idx) + BIT.Get(idx - 1)
  for i := idx; i < N; i += i & (-i) {
    (*BIT)[i] += d
  }
}
func (BIT BinaryIndexedTree) Query(s, t int) int {
  return BIT.Get(t) - BIT.Get(s)
}
func (BIT *BinaryIndexedTree) Increment(idx int) {
  N := len((*BIT))
  for i := idx; i < N; i += i & (-i) {
    (*BIT)[i]++
  }
}
func (BIT *BinaryIndexedTree) Decrement(idx int) {
  N := len((*BIT))
  for i := idx; i < N; i += i & (-i) {
    (*BIT)[i]--
  }
}
func InitBIT(N int) BinaryIndexedTree {
  BIT := make([]int, N + 1)
  return BIT
}

func Solve() {
  var N, M int
  NextInt(&N, &M)
  LR := make([][]int, N)
  for i := range LR {
    NextIntVec(&LR[i])
  }
  sort.Sort(Area(LR))
  BIT := InitBIT(M + 1)
  pos := 0
  for d := 1; d <= M; d++ {
    for pos < N && LR[pos][1] - LR[pos][0] + 1 < d {
      BIT.Increment(LR[pos][0])
      BIT.Decrement(LR[pos][1] + 1)
      pos++
    }
    cnt := N - pos
    for m := d; m <= M; m += d {
      cnt += BIT.Get(m)
    }
    Write(cnt)
  }
  return
}

func main() {
  Solve()
  Output()
}

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

using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    
    for(int i=0;i<n;i++)
        cin>>a[i];
    
    int c=0;
    for(int i=0;i<(1<<n);i++){
        for(int j=0;j<n;j++){
            if(a[j]%2!=0)
                goto Exit;
            a[j]=a[j]/2;
        }
        c++;
    }
    
    Exit:
        ;
    
    cout<<c<<endl;
}

Measured memory_bytes: 3556
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 100000;

/* typedef */

/* global variables */

int bs[MAX_N];
bool ps[MAX_N];

/* subroutines */

/* main */

int main() {
  int n, m;
  cin >> n >> m;
  
  for (int i = 0; i < n; i++) bs[i] = 1, ps[i] = false;
  ps[0] = true;

  for (int i = 0; i < m; i++) {
    int xi, yi;
    cin >> xi >> yi;
    xi--, yi--;

    ps[yi] |= ps[xi];
    bs[yi]++;
    if (--bs[xi] == 0) ps[xi] = false;
  }

  int cnt = 0;
  for (int i = 0; i < n; i++)
    if (ps[i]) cnt++;
  printf("%d\n", cnt);
  return 0;
}


Measured memory_bytes: 768
from operator import itemgetter


def main():
    N = int(input())
    ab = [tuple(int(j) for j in input().split()) for i in range(N)]
    cd = [tuple(int(j) for j in input().split()) for i in range(N)]
    # y 降順
    ab.sort(key=itemgetter(1), reverse=True)
    # x 昇順
    cd.sort(key=itemgetter(0))
    # ペアになった赤
    done = [False] * N
    for bx, by in cd:
        for k, ((rx, ry), d) in enumerate(zip(ab, done)):
            if not d and rx < bx and ry < by:
                done[k] = True
                break
    print(sum(done))
    return


main()


Measured memory_bytes: 3064
/*

*/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
 
#define ll long long
#define cint const int
#define ld long double
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
 
using namespace std;
 
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef pair <int, int> pi;
//typedef pair <long long, long long> pll;
//typedef pair <int, long long> pil;
//typedef pair <int, string> pis;
//typedef pair <int, char> pic;
//typedef pair <long long, int> pli;
//typedef pair <long long, string> pls;
//typedef pair <long long, char> plc;
//typedef pair <string, int> psi;
//typedef pair <string, long long> psl;
//typedef pair <string, char> psc;
//typedef pair <char, int> pci;
//typedef pair <char, long long> pcl;
//typedef pair <char, string> pcs;

int n;
string s1, s2;

int main () {
	cin >> n >> s1 >> s2;
	for (int i = 0; i < n; ++i) {
		cout << s1[i] << s2[i];
	}
	return 0;
}

Measured memory_bytes: 256
n = int(input())


def concat_board(board1, board2):
    # クォリティーが同じ２つのboardを対角線上に配置して繋ぐ
    # A..
    # .BB
    # .BB
    x, y = len(board1), len(board2)
    board = []
    sr = '.' * y
    board += [board1[i] + sr for i in range(x)]
    sl = '.' * x
    board += [sl + board2[i] for i in range(y)]
    return board


def make3board(x):
    # 3x3のクォリティー2の敷き詰め方
    # aab
    # d.b
    # dcc
    base = ["aab", "d.b", "dcc"]
    if x == 3:
        return base
    else:
        return concat_board(base, make3board(x - 3))


def make4board(x):
    # 4x4のクォリティー3の敷き詰め方
    # aagh
    # bbgh
    # cdee
    # cdff
    base = ["aagh", "bbgh", "cdee", "cdff"]
    if x == 4:
        return base
    else:
        return concat_board(base, make4board(x - 4))


def make5board(x):
    # 5x5のクォリティー3の敷き詰め方
    # aadde
    # bbg.e
    # ccgff
    # ..abc
    # ..abc
    base = ["aadde", "bbg.e", "ccgff", "..abc", "..abc"]
    if x == 5:
        return base
    else:
        return concat_board(base, make5board(x - 5))


board = []
if n % 3 == 0:
    board = make3board(n)
elif n % 4 == 0:
    board = make4board(n)
elif n % 5 == 0:
    board = make5board(n)
elif n == 7 or n == 11:
    board = [
        "aabbcc.", "dd.dd.c", "..d..dc", "..d..db", "dd.dd.b", "..d..da",
        "..d..da"
    ]
    if n == 11:
        board = concat_board(board, make4board(4))
else:
    for x in range(4, n, 4):
        y = n - x
        if y % 5 == 0:
            board = concat_board(make4board(x), make5board(y))
            break

if len(board) != 0:
    print(*board, sep='\n')
else:
    print(-1)


Measured memory_bytes: 6628
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for (int i = (a); i <= (b); ++i)
#define REPD(i,a,b) for (int i = (a); i >= (b); --i)
#define FORI(i,n) REP(i,1,n)
#define FOR(i,n) REP(i,0,int(n)-1)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define SZ(x) int((x).size())
#define DBG(v) cerr << #v << " = " << (v) << endl;
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define fi first
#define se second

int n;
ll a[55], b[55];
vector<pii> res;

bool solve(int p, int q) {
	FORI(i,n) a[i]=b[i];
	res.clear();
	for (int i = p-1; i >= 1; i--) {
		if (a[i]+a[i+1]*2 > a[i+1]) return false;
		while (a[i] > a[i+1]) {
			res.pb(mp(i+1,i));
			a[i] += a[i+1];
		}
	}
	for (int i = q+1; i <= n; i++) {
		if (a[i]+a[i-1]*2 < a[i-1]) return false;
		while (a[i-1] > a[i]) {
			res.pb(mp(i-1, i));
			a[i] += a[i-1];
		}
	}
	printf("%d\n", SZ(res));
	FOR(i,SZ(res)) {
		printf("%d %d\n", res[i].fi, res[i].se);
	}
	return true;
}

int main() {
	scanf("%d", &n);
	FORI(i,n) scanf("%lld", &a[i]);
	FORI(i,n) b[i]=a[i];
	a[0]=b[0]=-1e8;
	a[n+1]=b[n+1]=1e8;
	for (int p=0; p<=n; p++) if (b[p]<0) {
		for (int q=p+1; q<=n+1; q++) {
			if (b[q]<0) {
				break;
			} else if (b[q]>0) {
				if (solve(p,q)) {
					return 0;
				}
			}
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll long long
#define int long long
#define pb push_back
#define x first
#define ld long double
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) a.begin(),a.end()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin >> n >> k;
    vector <int> a(n);
    for (auto &i : a) cin >> i;
    int l = 1, r = 1e9 + 11;
    while (l < r) {
        int mid = (l + r) >> 1ll;
        int cur = 0;
        for (auto &i : a) {
            cur += (i - 1) / mid;
        }
        if (cur <= k) r = mid;
        else l = mid + 1;
    }
    cout << r << '\n';
}


Measured memory_bytes: 4780
//10のi乗pow(10, i);
#include <bits/stdc++.h>
using namespace std;

int main() {
	int h,n;
  	cin >> h >>n;
  	int sum=0;
 	int num=0;
	for(int i=0;i<h;i++){
    sum += n*pow(10, i);  
    }
  	for(int i=0;i<n;i++){
    num += h*pow(10, i);  
    }
	if(sum>num) cout<<sum<<endl;
  else cout<<num<<endl;
}  

Measured memory_bytes: 256
/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.

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

int mod = 1000000007;
ll dp[100005];;

ll gcd(long long a,long long b){

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


bool sortByVal(const pair<string, int> &a,
               const pair<string, int> &b)
{
    return (a.second < b.second);
}

int main(){

 string s;
 cin>>s;
 map<char,int>mp;

 for(int i=0;i<s.length();i++){
    mp[s[i]]++;
 }

 for(map<char,int>::iterator it=mp.begin();it!= mp.end();it++){

  if(it->second % 2 != 0){
  cout<<"No"<<endl;
  return 0; }
 }

 cout<<"Yes"<<endl;

return 0;
}


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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> num(N);
  
  for (int i=0; i < N; i++) {
    cin >> num.at(i);
  }
  
  sort(num.begin(), num.end());
  reverse(num.begin(), num.end());
  
  int cnt = 0;
  int previous = -1;
  for (int i=0; i < N; i++) {
    if (num.at(i) < previous || previous < 0) {
      cnt++;
      previous = num.at(i);
    }
  }
  
  cout << cnt << endl;
}

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

using namespace std;

const int maxn = 110;
bool flag = true;
int n,tong[maxn],maxx,minn;

int main()
{
    scanf("%d",&n);
    minn = n;
    for (int i = 1; i <= n; i++)
    {
        int x;
        scanf("%d",&x);
        tong[x]++;
        maxx = max(maxx,x);
    }
    if (tong[maxx] <= 1)
        flag = false;
    tong[maxx] -= 2;
    for (int i = 2; i <= maxx; i++)
    {
        int temp = max(i - 1,maxx - i + 1);
        minn = min(minn,temp + 1);
        if (!tong[temp])
            flag = false;
        tong[temp]--;
    }
    for (int i = 1; i < minn; i++)
        if (tong[i])
            flag = false;
    if (flag)
        puts("Possible");
    else
        puts("Impossible");

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

string s[50];
int cnt[50][26];
int Min[26];
signed main() {
	int n; scanf("%d", &n);
	memset(Min, 0x3f, sizeof(Min));
	rep(i, n) {
		cin >> s[i];
		for (char c : s[i])cnt[i][c - 'a']++;
		rep(j, 26)Min[j] = min(Min[j], cnt[i][j]);
	}
	rep(i, 26)cout << string(Min[i], 'a' + i);
	cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
#include <numeric>
#include <math.h>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)

typedef long long ll;
typedef long long int lli;

int main() {
    int N, K, res; 
    cin >> N >> K;
    
    res = (N - 1) / (K - 1);
    if ((N - 1) % (K - 1) != 0) {
        cout << res+1 << endl;
    } else {
        cout << res << endl;
    }
    
	return 0;
}

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


int h,m,s;

bool input(){
  cin>>h>>m>>s;
  if(h==-1)return false;
  return true;
}

char ans[2][100];
void solve(){
  const int  time = 60 * 120;
  int tmp = 60 * 60 * h + 60 * m + s;
  int now = time - tmp;
  
  tmp = now;
  int a_s = tmp % 60;
  tmp /= 60;
  int a_m = tmp % 60;
  tmp /= 60;
  int a_h = tmp;
  sprintf(ans[0],"%02d:%02d:%02d",a_h,a_m,a_s);

  tmp = now * 3;
  a_s = tmp % 60;
  tmp /= 60;
  a_m = tmp % 60;
  tmp /= 60;
  a_h = tmp;
  sprintf(ans[1],"%02d:%02d:%02d",a_h,a_m,a_s);
}

int main(){
  while(input()){
    solve();
    cout<<ans[0]<<endl<<ans[1]<<endl;
  }
}

Measured memory_bytes: 1196
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <stack>
typedef long long int lli;
using namespace std;

const int MAX_WH=16;
int W,H;
int wh[MAX_WH+1][MAX_WH+1];
int ans;

void dfs(int x,int y){
	//cout << x << " " << y << "\n";
	if(x==W&&y==H) {
		++ans;
		return;
	}
	if(x+1<=W&&wh[x+1][y]!=1) dfs(x+1,y);
	if(y+1<=H&&wh[x][y+1]!=1) dfs(x,y+1);
}
int main(){
	int n;
	while(cin >> W >> H&&W!=0&&H!=0){
		cin >> n;
		ans=0;
		for(int i=1;i<=W; ++i){
			for(int j=1; j<=H; ++j){
				wh[i][j]=0;
			}
		}
		for(int i=0; i<n; ++i){
			int c,d;
			cin >> c >> d;
			wh[c][d]=1;
		}
		dfs(1,1);
		cout << ans << "\n";
	}
	return 0;
}

Measured memory_bytes: 1160
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;
int N,M;
int a[55],b[55];
int c[55]={};
int main() {
    cin>>N>>M;
    for(int i=1;i<M+1;i++){
    	cin>>a[i]>>b[i];
    	c[a[i]]+=1;
    	c[b[i]]+=1;
    }

    for(int i=1;i<N+1;i++){
    	cout<<c[i]<<endl;
    }
    return 0;
}


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

typedef long long ll;
using namespace std;

int a[100005];
int n;

ll calc(int mod)
{
    ll sum = 0, res = 0;
    for (int i = 1; i <= n; i++){
        sum += a[i];
        if (i % 2 == mod && sum <= 0){
            res += (1 - sum);
            sum = 1;
        }
        else if(i % 2 != mod && sum >= 0){
            res += (sum + 1);
            sum = -1;
        }
    }
    return res;
}

int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++){
        cin >> a[i];
    }
    cout << min(calc(0), calc(1)) << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
#define MAX_N 100100
#define MOD 998244353
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}

ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

void  base_num(ll data,ll base){
    if(data==0) return;
    ll next=abs(data)%abs(base);
    if(data<0) next=(abs(base)-next)%abs(base);
    base_num((data-next)/base,base);
    cout << next;
}

int main(){
    ll n,q;
    string s;
    cin >> n >> q >> s;
    ll x[n];
    x[0]=0;
    for (ll i=1;i<n;i++){
        if (s[i-1]=='A' and s[i]=='C'){
            x[i]=x[i-1]+1;
        }else{
            x[i]=x[i-1];
        }
        
    }
    for (ll i=0;i<q;i++){
        ll l,r;
        cin >> l >> r;
        cout << x[r-1]-x[l-1] << endl;
    }
    return 0;
}



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

using namespace std;

int main(){
    long long n=0,ans=0;
    //char s[200];
    bool flag = false;
    //vector<int> a(N,0);

    cin >> n;

    for(int i=0;i<n;i++){
        if(((i+1)%3 != 0) && ((i+1)%5 != 0)){
            ans += i+1;
        }
    }


    

    cout << ans << endl;
    //cout << ( (flag) ? "Yes" : "No" ) << endl;
}


Measured memory_bytes: 3672
#include <cstdio>
#include <iostream>

using namespace std;

#define MAX_N 200005

int N;
int A[MAX_N];

void solve() {
  int x = 0;
  for (int i = 0; i < N; i++) {
    x ^= A[i];
  }
  for (int i = 0; i < N; i++) {
    printf("%d ", x ^ A[i]);
  }
  puts("");
}

int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d", A+i);
  }
  solve();
}


Measured memory_bytes: 4468
# D - Digits Parade
# https://atcoder.jp/contests/abc135/tasks/abc135_d

S = input()
n = len(S)

MOD = 10 ** 9 + 7

# dp[i][j] i桁目まででj余る数
dp = [[0] * 13 for _ in range(n + 1)]
dp[0][0] = 1

for i, s in enumerate(S):
  for j in range(10):
    if s == "?" or int(s) == j:
      for k in range(13):
        dp[i + 1][(k * 10 + j) % 13] += dp[i][k]
  for k in range(13):
    dp[i + 1][k] %= MOD

print(dp[n][5])


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

using namespace std;

int main(){
    long long int n,d;
    cin >> n >> d;
    int ans = 0;
    for(int i = 0 ; i < n ; i++){
        long double x,y;
        cin >> x >> y;
        long double dist = ((x*x) + (y*y));  
        //cout << dist << endl;
        long double prod = d*d;
        //cout << prod << endl;
        if(dist <= prod){
            //cout << " oo f" <<  dist << " " << d << endl;
            ans++;
        }
    }
    cout << ans << endl;


    return 0;
}

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

int main() {
    string s;
    cin >> s;
    int cnt0 = 0;
    int cnt1 = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '0') cnt0++;
        if (s[i] == '1') cnt1++;
    }
    cout << min(cnt0, cnt1) * 2 << endl;
}


Measured memory_bytes: 512
def main():
    from collections import defaultdict
    import sys
    input = sys.stdin.readline

    H, W, N = map(int, input().split())
    ans = [0] * 10
    ans[0] = (H - 2) * (W - 2)
    # print (ans)
    tmplst = [-1, 0, 1]
    dic = defaultdict(int)
    for _ in range(N):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        for i in tmplst:
            if 0 <= a + i <= H - 1:
                for j in tmplst:
                    if 0 <= b + j <= W - 1: #範囲に入っている
                        tmp = dic[(a + i, b + j)]
                        dic[(a + i, b + j)] += 1
                        if 1 <= a + i <= H - 2 and 1 <= b + j <= W - 2:
                            ans[tmp] -= 1
                            ans[tmp + 1] += 1

    print (*ans, sep = '\n')

if __name__ == '__main__':
    main()

Measured memory_bytes: 166908
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define N 100007
#define INF 1000000007
using namespace std;

typedef long long ll;

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

int main()
{
    int d;
    cin >> d;
    string s[26] = {};
    s[25] = "Christmas";
    s[24] = "Christmas Eve";
    s[23] = "Christmas Eve Eve";
    s[22] = "Christmas Eve Eve Eve";

    cout << s[d] << endl;

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
using namespace std;
int main(void)
{
	int n,i;
	double x,y,x1,y1;
	while(1)	{
		scanf("%d",&n);
		if(n==-1)	break;
		x=1.0;	y=0.0;
		for(i=0;i<n-1;i++)	{
			x1=x-y/sqrt(x*x+y*y);
			y1=y+x/sqrt(x*x+y*y);
			x=x1;
			y=y1;
//			printf("%lf %lf\n",x,y);
		}
		printf("%.2lf\n",x);
		printf("%.2lf\n",y);
	}
	return 0;
}


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N;
  while(cin>>N, N){
	VI cnt(26);
	int ans = -1;
	string winner = "TIE";
	REP(i,N){
	  char c; cin >> c;
	  if(ans > 0) continue;
	  cnt[c-'A']++;

	  REP(k,26){
		int mx = 0;
		REP(j,26)
		  if(k == j) continue;
		  else maxi(mx, cnt[j]);
		
		if(cnt[k] > mx + N-i-1){
		  ans = i+1;
		  winner = 'A' + k;
		  break;
		}
	  }
	}
	if(ans < 0){
	  int mx = *max_element(ALL(cnt));
	  if(count(ALL(cnt), mx) == 1){
		ans = N;
		winner = ('A' + find(ALL(cnt),mx) - begin(cnt));
	  }
	}

	cout << winner;
	if(ans > 0) cout << " " << ans;
	cout << endl;
  }

  return 0;
}

Measured memory_bytes: 3104
// abc151_a
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(int argc, char *argv[])
{
  char c;
  cin>>c;
  cout<<(char)(c+1)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>
#include <cctype>
#include <climits>
#include <list>
#include <queue>

#define INF 1000000000
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

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

  int A,B; cin>>A>>B;
  int road = A + B - 1;
  cout << A * B - road << endl;
}


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

#define all(X) (X).begin(), (X).end()
#define ll long long
#define linf (1ll << 60)

using namespace std;

// -------- FUNCS -------- //
vector<string> SPLIT(string str,char ch){vector<string> res;stringstream ss(str);string s;while(getline(ss, s, ch))res.push_back(s);return res;}
ll STOI(string str,int base){ll res=0;for(auto c:str){res*=base;res+=c-'0';}return res;}
string ITOS(ll val,int base){string res;while(val>0){res+='0'+(val%base);val/=base;}reverse(all(res));return res;}

// -------- Main Code -------- //
void runcase() {
    string s, t;
    cin >> s >> t;
    int res = 1e6;
    for (int i=0; i<s.size(); i++) {
        if (i + t.size()-1 >= s.size()) break;
        int cnt = 0;
        for (int j=0; j<t.size(); j++) cnt += (s[i+j] != t[j]);
        res = min(res, cnt);
    }
    cout << res << '\n';
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    // int t;
    // cin >> t;
    // while (t-- > 0)
        runcase();
    return 0;
}


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

using namespace std;


void solve() {
    int n; cin >> n;
    vector<int> a(n);
    for (auto& x: a) {
        cin >> x;
    }
    sort(a.begin(), a.end());
    int i = lower_bound(a.begin(), a.end(), 0) - a.begin();
    i -= 1;
    if (a[0] >= 0) i = 0;
    if (a[n-1] <= 0) i = n-2;
    int ne = 0, po = 0;
    for (int j = 0; j < n; j++) {
        if (j <= i) ne += a[j];
        else po += a[j];
    }
    int res = po - ne;
    cout << res << "\n";

    int crt = a[i+1];
    int j = i;
    while (j > 0) {
        cout << crt << ' ' << a[j] << "\n";
        crt -= a[j];
        j--;
    }
    if (i+1 == n-1) {
        cout << crt << ' ' << a[0];
        crt -= a[0];
        assert(crt == res);
        return;
    }
    cout << a[0] << ' ' << crt << "\n";
    crt = a[0] - crt;
    j = i+2;
    while (j < n-1) {
        cout << crt << ' ' << a[j] << "\n";
        crt -= a[j];
        j++;
    }
    cout << a[n-1] << ' ' << crt << "\n";
    crt = a[n-1] - crt;
    assert(crt == res);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 2304
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long 
#define pb push_back
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int>>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9)
#define ll_MIN (ll)(-1e9*1e9)
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl; 
#define cno cout << "No" << endl;
#define mod (long long)1000000007
#define mod2 (long long)998244353
#define INT_MAX1 900000000
#define MAXN 2000000
#define INF INT_MAX



 
void solve()
{
    int n;
    cin >> n;
    n %= 10;
    if(n==2 or n==4 or n==5 or n==7 or n==9)
        cout << "hon" << endl;
    else
        if(n==3)
            cout << "bon" <<endl;
    else
        cout << "pon" << endl;
}


signed main()
{
    
    speed;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}

Measured memory_bytes: 3652