akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

class MainClass
{
    public static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());

        int[][] a_b_c = new int[N][];

        int[][] dp = new int[N][];

        for (var i = 0; i < N; i++)
        {
            a_b_c[i] = new int[3];
            dp[i] = new int[] { 0, 0, 0 };
        }

        for (var i = 0; i < N; i++)
        {
            var tempInput = Console.ReadLine().Split(' ');

            for ( var j = 0; j < 3; j++)
            {
                a_b_c[i][j] = int.Parse(tempInput[j]);
            }
        }

        // ループ
        for (int i = 0; i < N - 1; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                for (int k = 0; k < 3; k++)
                {
                    if (j == k) continue;

                    dp[i + 1][k] = chmax(dp[i + 1][k], dp[i][j] + a_b_c[i][k]);
                }
            }
        }

        var ans = new int[] { 0, 0, 0 };

        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                if (i == j) continue;

                ans[j] = chmax(ans[j], dp[N - 1][i] + a_b_c[N - 1][j]);
            }
        } 

        Console.WriteLine(ans.Max());
    }

    public static T chmin<T>(T a, T b) where T : IComparable
    {
        if (a.CompareTo(b) > 0)
        {
            a = b;
            return a;
        }
        return a;
    }

    public static T chmax<T>(T a, T b) where T : IComparable
    {
        if (a.CompareTo(b) < 0)
        {
            a = b;
            return a;
        }
        return a;
    }
}


Measured memory_bytes: 30252
#include <stdio.h>
#include <string.h>
#include <math.h>

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

  if (scanf("%d", &A) == 1)
    ;

  if (A >= 30)
  {
    printf("Yes");
  }
  else
  {
    printf("No");
  }

  return (0);
}


Measured memory_bytes: 1724
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1, (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

//Graph in adjcency list
class Graph{
public:
    int N;
    vector<vector<pair<int,ll>>> adjlist;

    Graph(int n) : N(n), adjlist(n){}

    void setEdge(int a, int b, ll c){
        adjlist[a].push_back(make_pair(b, c));
    }

    int dfs(int v, vector<bool> check){
        int c = 0;
        check[v] = true;
        bool flag = true;
        for(auto i : check){
            flag &= i;
        }
        if(flag){
            return 1;
        }
        for(auto i : adjlist[v]){
            if(!check[i.first]){
                c += dfs(i.first, check);
            }
        }
        return c;
    }
};

int main(){
    int n, m;
    cin >> n >> m;
    Graph G(n);
    REP(i, m){
        int a, b;
        cin >> a >> b;
        G.setEdge(a-1, b-1, 1);
        G.setEdge(b-1, a-1, 1);
    }
    vector<bool> check(n, false);
    cout << G.dfs(0, check) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <cassert>
#include <string>

using namespace std;

class Node {
public:
    void print() {
        cout << "node " << id_ << ": parent = ";
        printParent();
        cout << ", depth = " << depth_ << ", " << type_ << ", [";
        printChild();
        cout << "]" << endl;
    }
    void printChild() {
        bool first = true;
        for (auto item : child_) {
            if (first) {
                cout << item->id_;
                first = false;
            }
            else {
                cout << ", " << item->id_;
            }
        }
    }
    void printParent() {
        if (parent_ != nullptr) {
            cout << parent_->id_;
        }
        else {
            cout << "-1";
        }
    }
    void addChild(int id) {
        Node* child = nodes_ + id;
        child_.push_back(child);
        child->setParent(this);
    }
    void setDepth(int depth) {
        depth_ = depth;
        for (auto item : child_) {
            item->setDepth(depth + 1);
        }
    }
    void setType() {
        type_ = "root";
        for (auto item : child_) {
            item->setTypeInternalOrLeaf();
        }
    }
    void setTypeInternalOrLeaf() {
        if (child_.size() == 0) {
            type_ = "leaf";
        }
        else {
            type_ = "internal node";
            for (auto item : child_) {
                item->setTypeInternalOrLeaf();
            }
        }
    }
    static Node* findRoot() {
        Node* node = nodes_;
        while (node->parent_ != nullptr) {
            node = node->parent_;
        }
        return node;
    }
    static void setup() {
        nodes_ = new Node[100000];
    }
    static Node* getNode(int id) {
        Node* node = nodes_ + id;
        node->setId(id);
        return node;
    }
private:
    Node() : id_(-1), depth_(-1), parent_(nullptr) {}
    void setId(int id) { id_ = id; }
    void setParent(Node* parent) { parent_ = parent; }
    int id_;
    int depth_;
    //vector<int> iLeaf_;
    vector<Node*> child_;
    Node* parent_;
    string type_;

    static Node* nodes_;
};

Node* Node::nodes_;

int main()
{
    Node::setup();

    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int id;
        cin >> id;
        assert(id<n);
        Node* node = Node::getNode(id);
        int k;
        cin >> k;
        for (int j = 0; j < k; ++j) {
            int c;
            cin >> c;
            assert(c < n);
            node->addChild(c);
        }
    }

    Node* root = Node::findRoot();
    root->setDepth(0);
    root->setType();

    for (int i = 0; i < n; ++i) {
        Node* node = Node::getNode(i);
        node->print();
    }

}



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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N=in();
	
	cout << (N%2 ? 2*N : N) << endl;
	return 0;
}


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

int main(void){
  
    int i,j,n,m,kyori,ans,min;
    long int a[50],b[50],c[50],d[50];
    
    scanf( "%d %d", &n,&m );
    
    for( i = 0; i < n; i++ ){
        scanf( "%ld %ld",&a[i],&b[i] );
    }
    
    for( i = 0; i < m; i++ ){
        scanf( "%ld %ld",&c[i],&d[i] );
    }
    
    for( i = 0; i < n; i++ ){
        ans = 0;
        min = 1000000001;
        for( j = 0; j < m; j++ ){
            kyori = labs( a[i] - c[j] ) + labs( b[i] - d[j] );
            if( kyori < min ){
                min = kyori;
                ans = j+1;
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}

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

int main() {
  string s;
  cin >> s;
  int blue = 0, red = 0;
  for (int i = 0; i < s.size(); i++) {
      if (s.at(i) == '0')
      red++;
      else
      blue++;
  }

  cout << min(red, blue) * 2 << endl;
}


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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define PB push_back
#define MP make_pair
#define ALL(x) (x).begin(),(x).end()
typedef long long ll;

int N,K,Y,X;

int main()
{
	cin >> N >> K >> X >> Y;

	int ans = 0;
	FOR(i,0,N){
		if(i < K){
			ans += X;
		}
		else{
			ans += Y;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
sx,sy,tx,ty=map(int,input().split())
dx=tx-sx
dy=ty-sy
R1='U'*dy+'R'*dx
R2='D'*dy+'L'*dx
R3='L'+'U'*(dy+1)+'R'*(dx+1)+'D'
R4='R'+'D'*(dy+1)+'L'*(dx+1)+'U'
print(R1+R2+R3+R4)


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>

using namespace std;


int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N - 1);
  for(int i = 0; i < N - 1; ++i){
    cin >> B[i];
  }

  for(int i = 0; i < N; ++i){
    if (i == 0) {
      A[i] = B[i];
    } else if (i == N - 1) {
      A[i] = B[i - 1];
    } else {
      A[i] = min(B[i], B[i - 1]);
    }
  }
  cout << accumulate(A.begin(), A.end(), 0) << endl;

  return 0;
};


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
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; }
//#define int long long

struct UnionFind {
    vector<int> par, w;
    
    UnionFind(int n) : par(n, -1), w(n, 0) { }
    void init(int n) { par.assign(n, -1); w.assign(n, 0); }
    
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) {
            ++w[x];
            return false;
        }
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        w[x] += w[y];
        ++w[x];
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
 
    int wei(int x) {
        return w[root(x)];
    }
};

void solve() {
	int n, m; cin >> n >> m;
	UnionFind uf(n + m);
	rep(i, n) {
		int k; cin >> k;
		rep(j, k) {
			int l; cin >> l; --l;
			uf.merge(i, n + l);
		}
	}
	int r = uf.root(0);
	rep(i, n) {
		if(!uf.issame(i, r)) {
			cout << "NO" << endl;
            return;
		}
	}
	cout << "YES" << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 1792
#![allow(dead_code)]
use crate::scanner::Scanner;
use maplit::hashset;
fn main() {
    let mut scan = Scanner::new();
    let n = scan.read::<usize>();
    let d = n % 10;
    println!(
        "{}",
        if d == 3 {
            "bon"
        } else if hashset!(0, 1, 6, 8).contains(&d) {
            "pon"
        } else {
            "hon"
        }
    );
}
mod scanner {
    use std::io::{stdin, BufReader, Bytes, Read, Stdin};
    use std::str::FromStr;
    pub struct Scanner {
        buf: Bytes<BufReader<Stdin>>,
    }
    impl Scanner {
        pub fn new() -> Scanner {
            Scanner {
                buf: BufReader::new(stdin()).bytes(),
            }
        }
        pub fn read_next<T: FromStr>(&mut self) -> Option<T> {
            let token = self
                .buf
                .by_ref()
                .map(|c| c.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect::<String>();
            token.parse::<T>().ok()
        }
        pub fn read<T: FromStr>(&mut self) -> T {
            self.read_next().unwrap()
        }
        pub fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.read::<T>()).collect()
        }
        pub fn chars(&mut self) -> Vec<char> {
            self.read::<String>().chars().collect()
        }
    }
}



Measured memory_bytes: 2160
#include<stdio.h>
int main(){
    int a[5],b[5],i;
    for(i=0;i<4;i++)scanf("%d",&a[i]);
    for(i=0;i<4;i++)scanf("%d",&b[i]);
    if(a[0]+a[1]+a[2]+a[3]>b[0]+b[1]+b[2]+b[3])printf("%d",a[0]+a[1]+a[2]+a[3]);
    else if(a[0]+a[1]+a[2]+a[3]<b[0]+b[1]+b[2]+b[3])printf("%d",b[0]+b[1]+b[2]+b[3]);
    else printf("%d\n",b[0]+b[1]+b[2]+b[3]);
    return 0;
}

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

int main() {
  vector<pair<int, int>> move = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
  int                    H, W;
  cin >> H >> W;
  vector<string> s(H);
  for (int i = 0; i < H; i++) {
    cin >> s.at(i);
  }
  bool ans = true;
  for (int ih = 0; ih < H; ih++) {
    for (int iw = 0; iw < W; iw++) {
      if (s.at(ih).at(iw) == '.') continue;
      ans = false;
      for (int im = 0; im < move.size(); im++) {
        int h = ih + move.at(im).first;
        int w = iw + move.at(im).second;
        if (h < 0 || H <= h) continue;
        if (w < 0 || W <= w) continue;
        if (s.at(h).at(w) == '#') {
          ans = true;
          break;
        }
      }
      if (!ans) break;
    }
    if (!ans) break;
  }
  cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    long double A,B;
    cin >> A >> B;
    cout << (ll)floorl(A*B) << endl;
    return 0;
}

Measured memory_bytes: 3748
s = input()
t = input()

import fnmatch

if len(s) < len(t):
    print('UNRESTORABLE')
else:
    l = []
    for  i in range(len(s) - len(t)+1):
        if fnmatch.fnmatch(t, s[i:i+len(t)]):
            x = s[0:i] + t + s[i+len(t):]
            l += [x.replace('?', 'a')]

    else:
        if len(l) == 0:
            print('UNRESTORABLE')
        else:
            l.sort()
            print(l[0])

Measured memory_bytes: 3828
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int a, b, d, e;
double f;
cin >> a >> b;
d = a / b;
e = a % b;
f = (double)a / (double)b;
printf("%d %d %lf", d, e, f);
return 0;
}

Measured memory_bytes: 1192
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	private static final int BALLS = 10;

	public static void main(String[] args) {
		int dataSet = sc.nextInt(); //???????????????????????°?????\?????????????????????

		for(int $ = 0; $ < dataSet; $++) {
			int box1 = 0;
			int box2 = 0;
			boolean flag = true;

			//?????????????????????????????????
			//YES???NO??????
			for(int count = 0; count < BALLS; count++) { //??????????????°????????°?????????
				int ball = sc.nextInt();
				int between1 = ball - box1;
				int between2 = ball - box2;

				if(between1 < 0 && between2 < 0) { //?????????????????????2????????±?????\??£???????????????????°?????????¨???
					flag = false;
				} else if(between1 > 0 && between2 < 0) { //1?????±???????????????????????????????°????????????????2?????±????????????????????????????????§??????
					box1 = ball;
				} else if(between1 < 0 && between2 > 0) { //1?????±????????????????????????????????§???????????????2?????±???????????????????????????????°???????
					box2 = ball;
				} else if(between1 < between2) { //??????????????????2????????±??????????????§?????????1?????±????????????????????????????????????????????¨???
					box1 = ball;
				} else {
					box2 = ball;
				}
			}

			if(flag) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
				flag = true;
			}

		}

	}

}

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

using namespace std;
bool espar(string Y)
{
    long long x, i;
    x=Y.size();
    for(i=0; i<x/2; i++)
    {
        if(Y[i]!=Y[x/2+i])
        {
            return false;
        }

    }
    return true;
}
int main()
{
    long long N, contador;
    string S;
    cin >> S;
    N=S.size();
    contador=N-2;
    S.erase(N-2);
    while(espar(S)==false)
    {
        contador=contador-2;
        N=S.size();
        S.erase(N-2);
    }
    cout << contador << endl;
    return 0;
}

Measured memory_bytes: 256
def solve(string):
    n, *a = map(int, string.split())
    a = ["{:060b}".format(_a) for _a in a]
    m = 10**9 + 7
    ans = 0
    for s in map(lambda x: x.count("1"), zip(*a)):
        ans <<= 1
        ans += s * (n - s)
        ans %= m
    return str(ans)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))


Measured memory_bytes: 73056
#include <bits/stdc++.h>
using namespace std;
int main()
{
  long long int n;
  cin>>n;
  vector<long long int> store (n+1,0);
  for(long long int i=1;i<=n;i++)
  {
  	long long int j=1;
  	while(j*i<=n)
  	{
  		store[j*i]+=1;
  		j++;
	}
  }
  long long sum=0;
  for(long long int i=1;i<=n;i++)
  {
  	sum+=(i*store[i]);
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 81364
a=gets.chomp!
gets.to_i.times{
b = gets.split
c=b[1].to_i;d=b[2].to_i
a[c..d]=b[3] if b[0]=="replace"
a[c..d]=a[c..d].reverse! if b[0]=="reverse"
puts a[c..d] if b[0]=="print"
}


Measured memory_bytes: 6924
import java.util.*;

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

        char alpha;
        int[] alpha_num = new int[26];
        String str ="";

        while(sc.hasNext()){
            str += sc.nextLine();
        }

            for(int i = 0;i < str.length();i++){
                alpha = str.charAt(i);
                for(int j = 0;j < 26;j++){
                    if(alpha == (65 + j) || alpha == (97 + j))  alpha_num[j] += 1;
                }
            }

            for(int i = 0;i < 26;i++){
                System.out.println((char)(97 + i)+" : "+alpha_num[i]);
            }
        
    }
}


Measured memory_bytes: 26164
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;

ll br[100005];

int main() {
	ll n;
	scanf("%lld", &n);
	ll sol = 1;
	ll nigga = 3;
	for (ll i=0 ; i<n ; i++) {
		ll x;
		scanf("%d", &x);
		br[x]++;
		if (x) sol *= br[x-1], br[x-1]--;
		else sol *= nigga--;
		sol %= MOD;
	}
	printf("%I64d\n", sol);
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int c=0;
void insertSort(int arr[],int n ,int g){
	for (int  i = g; i < n;i++){
	  int v = arr[i];
      int j = i - g;
      while ( j >= 0 && arr[j] > v){
        arr[ j +g] = arr[ j];
        j = j-g;
        c++;
      }
      arr[ j +g] =v;
	}
};
void shellSort(int A[],int n){

	int G [13]= {1,4,13,40,121,364,1093,3280,9841,29524,88573,265720,797161}; //"h"=3*"h-1"+1
	int m= 0;
for (;n/9 >= G[m];m++){}
	printf("%d\n",m+1);
	for (int i= m;i >= 0;i--){
		printf("%d ",G[i]);
		insertSort(A,n,G[i]);
	}
	printf("\n");
};
int main(){

  int n ,i ,j , m ,t,g ,k ,v;
  scanf("%d" ,&n);
  int arr[n];
  for ( i = 0; i < n; i++){
    scanf("%d",&arr[i]);
  }
shellSort(arr,n);
  printf("%d\n",c);

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


  return 0;

}



Measured memory_bytes: 5604
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;

void test_case(){
	int x , y; cin >> x >> y;
	string ans = "No";
	for(int i = 0 ; i < x+1 ; i++){
		int b = x-i;
		if(2*i+4*b==y)
			ans = "Yes";
	}
	cout<<ans<<"\n";
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T=1;
	//~ cin >> T;
	while(T--){
		test_case();
	}
	return 0;
}


Measured memory_bytes: 3648
import collections
N,x,y=map(int,input().split())
lit=[]
for i in range(1,N+1):
  for j in range(i+1,N+1):
     lit.append(min(abs(i-j),abs(x-j)+abs(y-i)+1,abs(y-j)+abs(x-i)+1))
a=collections.Counter(lit)
for i in range(1,N):
  print(a[i])

Measured memory_bytes: 67816
s=input()
x=0;y=0
for i in range(len(s)):
  if s[i]=="A":
    x=i+1
    break
t=s[::-1]
for i in range(len(t)):
  if t[i]=="Z":
    y=len(s)-i
    break
#print(x,y)
print(y-x+1)

Measured memory_bytes: 3516
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define INF 2147483647
struct SqrtDecomposition {
  ll N, K, sqrtN;
  vector<ll> data;
  vector<ll> bucketMin;
  SqrtDecomposition(ll n) : N(n) {
    sqrtN = sqrt(N)+1;
    K = (N + sqrtN - 1) / sqrtN;
    data.assign(K * sqrtN, INF);
    bucketMin.assign(K, INF);
  }
  void update(ll x, ll y) {
    ll k = x / sqrtN;
    ll minVal = data[x] = y;
    for (ll i = k * sqrtN; i < (k + 1) * sqrtN; ++i) {
      minVal = min(minVal, data[i]);
    }
    bucketMin[k] = minVal;
  }
  // [x, y)
  ll find(ll x, ll y) {
    ll minVal = INF;
    for (ll k = 0; k < K; ++k) {
      ll l = k * sqrtN, r = (k + 1) * sqrtN;
      if (r <= x || y <= l)
        continue;
      if (x <= l && r <= y) {
        minVal = min(minVal, bucketMin[k]);
      } else {
        for (ll i = max(x, l); i < min(y, r); ++i) {
          minVal = min(minVal, data[i]);
        }
      }
    }
    return minVal;
  }
};

int main(void){
    long long n,q;
    cin>>n>>q;
    SqrtDecomposition sd(n);
    for(ll i=0;i<q;i++){
        long long c,x,y;
        cin>>c>>x>>y;
        if(c){
            cout<<sd.find(x,y+1)<<endl;
        }else{
            sd.update(x,y);
        }
    }
    return 0;
}



Measured memory_bytes: 3616
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
   public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s=sc.next();
        String t=sc.next();
        int count=0;
        int flag=0;
        int min=(int)1e5;
        for (int i=0;i<s.length();i++){
            count=0;
            for (int j=0;j<t.length();j++){
                if ((i+j)>=s.length()){
                    flag=1;
                    break;
                }
                if (t.charAt(j)!=s.charAt(j+i))count++;
            }
            if (flag==1)break;
            min=Math.min(min,count);
        }
       System.out.println(min);


    }





    static void sort(int[] a) {
        ArrayList<Integer> l=new ArrayList<>();
        for (int i:a) l.add(i);
        Collections.sort(l);
        for (int i=0; i<a.length; i++) a[i]=l.get(i);
    }
    static void sortReverse(long[] a) {
        ArrayList<Long> l=new ArrayList<>();
        for (long i:a) l.add(i);
//        Collections.sort.(l);
        Collections.sort(l,Collections.reverseOrder());
        for (int i=0; i<a.length; i++) a[i]=l.get(i);
    }

    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
        long nextLong() {
            return Long.parseLong(next());
        }
    }


}


Measured memory_bytes: 36140
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,a,b) for(int i=a;i<b;i++)
#define PB push_back
#define putn(x,n) cout<< fixed<< setprecision(n)<< x << endl;
typedef long long ll;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b, c,n=0;
	cin >> a >> b >> c;
	if (a == b){
		if (a == c)n = 1;
		else n = 2;
	}
	else if (b == c){
		n = 2;
	}
	else if (c == a){
		n = 2;
	}
	else n = 3;
	cout << n << endl;


	return 0;
}


Measured memory_bytes: 256
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

import fractions
from functools import reduce
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = onem()

a = l()

c = 0

for i in range(n):
    if c + 1 == a[i]:
        c += 1
if c == 0:
    print(-1)
else:
    print(n-c)







Measured memory_bytes: 102088
X = int(input())

A = []
if X < 4:
    ans = 1
else:
    for b in range(2, int(X ** 0.5) + 1):
        t = b ** 2
        while t <= X:
            A.append(t)
            t *= b
    A.sort()
    ans = A[-1]

print(ans)


Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N, x;
    cin >> N >> x;
    vector<int> ans(2 * N - 1, 0);
    bool flag = false;

    if (x >= 2 && x <= 2 * N - 2) {
        cout << "Yes" << endl;
        ans[N - 1] = x;
        if (x != 2 * N - 2) {
            ans[N] = x - 1;
            ans[N - 2] = x + 1;
            ans[N + 1] = x + 2;
            int num = 1;
            rep(i, 2 * N - 1) {
                if (ans[i] != 0) continue;
                if (num == x - 1) num += 4;
                ans[i] = num;
                num++;
            }
        }
        else {
            ans[N] = x + 1;
            ans[N - 2] = x - 1;
            ans[N + 1] = x - 2;
            int num = 1;
            rep(i, 2 * N - 1) {
                if (ans[i] != 0) continue;
                if (num == x - 2) num += 4;
                ans[i] = num;
                num++;
            }
        }
        rep(i, 2 * N - 1) cout << ans[i] << endl;
    }
    else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 1 ; i <=(n) ; i ++ )
#define all(x) (x).begin(),(x).end()
using ll = long long;
using namespace std;
double pi=3.141592;
int main() {
  int a,b;
  cin>>a>>b;
  if(a==1||b==1){ 
    if(a==1&&b==1)  cout<<"Draw"<<endl;
    else if(a!=1)  cout<<"Bob"<<endl;
    else cout<<"Alice"<<endl;
    
  }
  else {
    if(a<b)cout<<"Bob"<<endl;
    else if(b<a) cout<<"Alice"<<endl;
    else cout<<"Draw"<<endl;
  }
}

Measured memory_bytes: 256
/**
 *   created: 13 July 2019  09:12:11
**/
#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef vector< pair<int , int> > vii;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long> pll;
typedef vector< pair<long long , long long> > vll;

#define PB push_back
#define PPB pop_back
#define all(c) c.begin(),c.end()
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define rrep(i,a,b) for(int i = (int)(a-1); i>=(int)(b); i--)
#define INFLL 2000000000000000007
#define INF 2000000007
#define MOD 1000000007


#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif


void optimizeIO()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}

//                                        //AUTHOR: Kaushalesh Shukla

//=========================================================================================================


int main()
{
	optimizeIO();
	int tt=1;
	//cin>>tt;
	while(tt--){
		int n;
		cin>>n;
		vi v(n),v2(n);
		rep(i,0,n){
			cin>>v[i];
			v2[i] = v[i];
		}
		sort(all(v));
		rep(i,0,n){
			if(v2[i]==v[n-1])
				cout<<v[n-2]<<endl;
			else
				cout<<v[n-1]<<endl;
		}
	}
	return 0;
}



Measured memory_bytes: 3200
#include <iostream>
#include <string>
#include <sstream>
#include <utility>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <cmath>
#include <functional>
#include <chrono>
#include <cstring>
#include <bits/stdc++.h>


using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef pair<int,int> pii;

typedef vector<lint> vl;
typedef pair<lint,lint> pll;

#define mpr make_pair


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

    int n; cin>>n;
    if (n%1000) cout<<1000 - n%1000;
    else cout<<0;
}


Measured memory_bytes: 3648
#include <iostream>
    #include <stdio.h>
    #include <string>
    #include <cstdlib>
    #include <cmath>
    #include <algorithm>
    #include <string.h>
    #include <queue>
    #include <stack>
    #define _USE_MATH_DEFINES
    #define LL long long
    #define front top
    using namespace std;
    const double PI = acos(-1.0);
     
    int smax(int ary[]) {
    	int m = 0;
    	for (int i = 0; i < sizeof(ary) / sizeof(ary[0]); i++)
    		if (m < ary[i]) m = ary[i];
    	return m;
    }
     
    int nmax(int ary[]) {
    	int max = 0, num;
    	for (int i = 0; i < sizeof(ary) / sizeof(ary[0]); i++)
    		if (max < ary[i]) {
    			max = ary[i];
    			num = i;
    		}
    	return max, num;
    }
     
    bool dfs(int q, int value) {
    	return false;
    }
     
    int max2(int a, int b) {
    	if (a < b) a = b;
    	return a;
    }
     
    int min2(int a, int b) {
    	if (a > b) a = b;
    	return a;
    }
     
    int max3(int a, int b, int c) {
    	return max2(a, max2(b, c));
    }
     
    int min3(int a, int b, int c) {
    	return min2(a, min2(b, c));
    }
     
    LL a[2000000];
     
    int main() {
    	LL n, min = 3000000000000000;
    	LL sum = 0, com = 0, back, ans;
    	cin >> n;
    	for (int i = 0; i < n; i++) cin >> a[i];
     
    	for (int i = 0; i < n; i++)
    		sum += a[i];
    	back = sum;
    	for (int i = 0; i < n - 1; i++) {
    		com += a[i];
    		back -= a[i];
    		if (min > abs(back - com)) {
    			min = abs(back - com);
    		}
    	}
    	cout << min << endl;
    	return 0;
    }

Measured memory_bytes: 1792
#include <bits/stdc++.h>
int main(){int n,d,x,r=0;int a[d];std::cin>>n>>d>>x;for(int i=0;i<n;i++)std::cin>>a[i];for(int i=0;i<n;i++){int date=0,l=1;while(date<=d){date=a[i]*(l)+1;l++;r++;}}std::cout << r + x << std::endl;}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<string>
#include<cstdlib>
#include<stdio.h>
#include<cctype>
#include<algorithm>
#include<string.h>
#include<iomanip>
#define PI 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148
using namespace std;
#define A 0.33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333


int main()
{
	double x[105],y[105],m=-1,a[105];
	int n;
	double b=0,c=0,d=0;
	while(cin>>n){

		for(int i=0;i<n;i++)
			cin>>x[i];
		for(int i=0;i<n;i++)
			cin>>y[i];
	//?????\??????
	for(int i=0;i<n;i++)
		{
			a[i]=abs(x[i]-y[i]);
			b+=a[i];
			c+=a[i]*a[i];
			d+=a[i]*a[i]*a[i];
	}
	    for(int i=0;i<n;i++)
		{
	
         m=max(m,a[i]);
		}
		cout<<setiosflags(ios::fixed)<<setprecision(10);
		cout<<b<<endl;
		cout<<sqrt(c)<<endl;
		cout<<pow(d,A)<<endl;
		cout<<m<<endl;


		
		

	}
}

Measured memory_bytes: 3464
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);
		String input = "";
		try {
			input = br.readLine();
			// String str2 = br.readLine();
		} catch (IOException e) {
		}

		for (int i = 0; i < input.length(); i++)
			System.out.print(input.charAt(i) == ',' ? ' ' : input.charAt(i));
	}
}


Measured memory_bytes: 7892
# your code goes here
N = int(input())

prev = 0
ans = 0
flag = True
for i in range(N):
	now = int(input())
	
	if now - prev > 1 or (i == 0 and now != 0):
		print(-1)
		flag = False
		break
	elif now - prev == 1:
		ans += 1
	elif now:
		ans += now
	prev = now
if flag:
	print(ans)

		

Measured memory_bytes: 3188
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) cerr << #x << "=" << static_cast<bitset<16> >(x) << endl;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 10000000;
int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
typedef pair<int, int> P;

/** Problem0106 : Discounts of Buckwheat **/
int main()
{
	int price[5000]; fill(price, price+5000, INF);
	rep(a, 25) {
		rep(b, 25) {
			rep(c, 25) {
				int g = 200*a + 300*b + 500*c;
				int p = 380*a - (a/5*380*0.2*5) + b*550 - (b/4*550*0.15*4) + c*850 - (c/3*850*0.12*3);
				
				if (g>5000) continue;
				price[g] = min(price[g], p);
			}
		}
	}
	
	int in;
	while (cin>>in, in) {
		cout << price[in] << endl;
	}
}

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

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define erep(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9
const int mod = 1e9+7;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pi;
typedef long long i64;

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

  int a, b, c;
  cin >> a >> b >> c;
  if(a == b && a == c && !(a % 2)) {
    cout << -1 << endl;
    return 0;
  }

  int ans = 0;
  while(!(a % 2) && !(b % 2) && !(c % 2)) {
    int aa = b / 2 + c / 2;
    int bb = a / 2 + c / 2;
    c = a / 2 + b / 2;
    a = aa;
    b = bb;
    ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
use std::io;
use std::str::FromStr;

fn divs(n : i32) -> i32 {
    let mut ans : i32 = 2;
    for i in 2..n {
        if n % i == 0 {
            ans += 1;
        }
    }
    ans
}

fn main() {
    let n: i32 = read();
    println!("{}", (2..n+1).filter(|x| x % 2 == 1 && divs(x.clone()) == 8).count())
}



#[allow(dead_code)]
fn getline() -> String {
    let mut ln = String::new();
    io::stdin().read_line(&mut ln).ok();
    ln.trim().to_string()
}

#[allow(dead_code)]
fn read<T>() -> T where T : FromStr {
    let mut ln = String::new();
    io::stdin().read_line(&mut ln).ok();
    ln.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn reads<T>() -> Vec<T> where T : FromStr {
    let mut ln = String::new();
    io::stdin().read_line(&mut ln).ok();
    ln.trim().split_whitespace().map(|x| x.parse().ok().unwrap()).collect()
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
//const ll INF = 1e18;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);
 
int main()
{
	int a,b;
	cin >> a >> b;
	cout << max({a+b,a-b,a*b}) << endl;
	return 0;	
}

Measured memory_bytes: 764
s = gets.chomp.split("")
t = gets.chomp.split("")

ok = true

ma = {}
ima = {}

s.size.times do |i|
    si = s[i]
    ti = t[i]
    if ma.include?(si)
        if ma[si] != ti
            ok = false
        end
    end
    if ima.include?(ti)
        if ima[ti] != si
            ok = false
        end
    end
    ma[si] = ti
    ima[ti] = si
end

if ok
    puts "Yes"
else
    puts "No"
end

Measured memory_bytes: 22780
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
constexpr int MOD = 1000000007;
constexpr ll INF = 1LL<<60;

using namespace std;


signed main() {
  int D, G;
  cin >> D >> G;

  vector<int> p(D);
  vector<int> c(D);
  REP(i, D) cin >> p[i] >> c[i];

  int ans = INF;
  REP(i, (1<<D)){
    int point = 0, cnt = 0;
    int unused = 0;
    REP(j, D){
      if((i >> j)&1){
        cnt += p[j];
        point += p[j]*(j+1)*100+c[j];
      }else{
        unused = j;
      }
    }
    if(G <= point) ans = min(ans, cnt);
    else{
      if(G <= point+(p[unused]-1)*(unused+1)*100){
        while(point < G){
          cnt++;
          point += (unused+1)*100;
        }
        ans = min(ans, cnt);
      }
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy -2147382637
#define bql 2147483647
#define ll long long
#define ull unsigned long long
#define ld long double
#define maxn 100010
#define rp(i, l, r) for (int i = l; i <= r; i++)
#define rb(i, r, l) for (int i = r; i >= l; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;
ll gcd(ll a,ll b){ll r;while(b>0){r=a%b;a=b;b=r;}return a;}
ll powmod(ll a,ll b,ll mod) {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 main(){
	fast;
	ll a,b;
	cin>>a>>b;
	cout<<max(max(a+b,a*b),a-b)<<endl;
	return 0;
}/*『你强归你强，我永不示弱』*/


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

using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n); i > 0; i--)
#define all(n) n.begin(), n.end()
#define print(n) cout << n << endl

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int n,k,ans=1;
    cin >> n >> k;
    while(n>=k){
        n /= k;
        ans++;
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const int N = 110;
char f[N][N];

int main(){
    int a,b;
    cin >>a >>b;
    --a; --b;

    for(int i=0; i<50; ++i){
        rep(j,100) f[i][j] = '.';
    }
    for(int i=50; i<100; ++i){
        rep(j,100) f[i][j] = '#';
    }

    for(int i=1; i<49; i+=2){
        for(int j=1; j<100; j+=2){
            if(b==0) break;
            f[i][j] = '#';
            --b;
        }
        if(b==0) break;
    }

    for(int i=51; i<100; i+=2){
        for(int j=1; j<100; j+=2){
            if(a==0) break;
            f[i][j] = '.';
            --a;
        }
        if(a==0) break;
    }

    printf("100 100\n");
    rep(i,100){
        rep(j,100) printf("%c",f[i][j]);
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
    int n,m,k;cin >> n >> m >> k;
    vector<int> a(n),b(m);
    rep(i,n)cin >> a[i];
    rep(i,m)cin >> b[i];
    vector<int> s(m+1);
    rep(i,m)s[i+1] = s[i] + b[i];
    int ret = 0;
    //case 0
    {   
        ret = max(ret,(int)(upper_bound(s.begin(),s.end(),k) - s.begin())-1);

    }

    rep(i,n){
        k -= a[i];
        if(k < 0 )break;
        int tmp = i+1;
        tmp += upper_bound(s.begin(),s.end(),k) - s.begin()-1;
        // trace(i+1,tmp,k);
        ret = max(ret,tmp);
    }
    // trace(s);
    cout << ret << endl;

    return 0;
}

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

typedef long long ll;

using vi = vector<int>;
using vl = vector<long long int>;
using vii = vector<vector<int>>;
using vll = vector<vector<long long int>>;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
       const double pi=6.28318530717958623200;
      
       double r;
       cin>>r;
       double ans=r*pi;
       cout<<fixed<<setprecision(9)<<ans<<endl;


return 0;

}


Measured memory_bytes: 3780
#include <iostream>
#include <cstdio>
using namespace std;
int main(void){
    char x[1001];
    int i, s;

    for(;;){
        scanf("%s", x);
        if(x[0] == '0' && x[1] == '\0') break;
        s = 0;
        for(i = 0; x[i] != '\0'; i++)
            s += x[i] - '0';
        printf("%d\n", s);
    }
    return 0;
}


Measured memory_bytes: 3224
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
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;}
const int MOD = 1000000007;
//const int MOD = 998244353;
template<class T> inline int add(T& a, T b, T M = MOD){a=(a+M)%M;b=(b+M)%M;a=(a+b)%M;return a;};
template<class T> inline int mul(T& a, T b, T M = MOD){if(a>=M)a%=M;if(b>=M)b%=M;a*=b;if(a>=M)a%=M;return a;};
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret) %= MOD;
  if(n%2)((ret *= a) %= MOD);
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}
////////////////////////////////////////////////////////////////////
int n,a,b;
signed main(){
  cin>>n>>a>>b;
  bool c = true;
  if(n == 1 && a != b)c = false;
  if(a > b)c = false;
  int ans = (b*(n-1)+a)-(a*(n-1)+b)+1;
  cout << (c ? max(ans, 0LL) : 0LL) << endl;
}


Measured memory_bytes: 256