akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define pie 3.141592653589793238462643383279
#define INF 1000000007
#define ggr getchar(); getchar();return 0;
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}

int n;
string s, t;
bool ta;

signed main() {
	cin >> n >> s >> t;
	for (int i = 0; i < n; i++) {
		ta = true;
		for (int j = 0; j < n - i; j++) {
			if (s[i + j] != t[j])ta = false;
		}
		if (ta) {
			cout << n + i << endl;
			ggr
		}
	}
	cout << n * 2 << endl;
	ggr
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#pragma GCC optimize(3)   
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector < ll > vl;
typedef vector < vl > vvl;
typedef pair < ll, ll > pll;
typedef vector < pair < ll, ll > > vpll;
#define kill freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define pb push_back
#define fo(i,n) for(ll i=0;i<n;i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define all(c) c.begin(), c.end()
#define go(c,it) for(auto it=(c).begin(); it!=(c).end(); it++)
#define fi first
#define se second
#define MOD 998244353
#define Boost() ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MOD1 1000000007
ll power(ll a, ll b){ll res=1;a=a%MOD;while(b>0){if(b&1){res=(res*a)%MOD;}a=(a*a)%MOD;b>>=1;}return res;}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
#define oo 100000000000000000
const ll dx[]={-1,0,1, 0,-1,1, 1,-1};
const ll dy[]={ 0,1,0,-1, 1,1,-1,-1};
void solve(){
   ll n;
   cin>>n;
   string s;
   cin>>s;
   set<ll> pos;
   fo(i,n){
       if(s[i]=='R')pos.insert(i);
   }
   ll ans = 0;
   if(!pos.empty()){
       fo(i,n){
           if(s[i]=='W'){
               auto it = pos.end();
               it--;
               ll val = *it;
               if(val<i)break;
               swap(s[i],s[val]);
               pos.erase(it);
               pos.insert(i);
               ans++;
           }
       }
   }
   cout<<ans;
}
int main(){
    Boost();
    ll T = 1;
    //cin>>T;
    while(T--){
        solve();
    }
    return 0;
}


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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int h[n], p[n];
    vector<int> v;
    for (int i = 0; i < n; i++) {
        v.emplace_back(i);
        cin >> h[i] >> p[i];
    }
    auto cmp = [&](int i, int j) {
        if (h[i] + p[i] != h[j] + p[j]) return h[i] + p[i] < h[j] + p[j];
        return h[i] < h[j];
    };
    sort(v.begin(), v.end(), cmp);
    vector<long long> dp(n+1, 1e18);
    dp[0] = 0;
    for (int i = 0; i < n; i++) {
        int j = v[i];
        for (int k = n-1; k >= 0; k--) {
            if (dp[k] > h[j]) continue;
            dp[k+1] = min(dp[k+1], dp[k]+p[j]);
        }
    }
    for (int i = n; i >= 0; i--) {
        if (dp[i] != 1e18) {
            cout << i << "\n";
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <math.h>





int main()
{
    int N,K,ans = 1;
    
    scanf("%d %d",&N,&K);
    
    int a[N];
    
    for(int i = 0;i<N;i++)
        scanf("%d",&a[i]);
    N -= K;

    if(N%(K-1) != 0)
        printf("%d\n",ans + (N/(K-1)) +1);
    else if (N%(K-1) == 0)
        printf("%d\n",ans + (N/(K-1)));
   
    
    
    
    return 0;
    
}

Measured memory_bytes: 512
import java.util.Scanner;

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

    public static void solve(Scanner sc) {
        String a = sc.next();
        String b = new StringBuilder(a).reverse().toString();

        System.out.println(a.equals(b) ? "Yes" : "No");
    }
}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n, m, k, ans = 0;
    cin >> n >> m >> k;
    string s[6] = {};
    for (int i(0); i < n; ++i)
        cin >> s[i];
    for (int i(0); i < (1 << n); ++i) {
        for (int j(0); j < (1 << m); ++j) {
            int cnt = 0;
            for (int k = 0; k < n; ++k) {
                for (int l(0); l < m; ++l) {
                    if ((i & (1 << k)) and (j & (1 << l)) and s[k][l] == '#')cnt++;
                }
            }
            if (cnt == k)ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[][] s = new int[100][100];
		int[][] x = new int[N][2];
		int[][] a = new int[100][100];
		for(int i = 0; i < N; i++) {
			x[i][0] = 50;
			x[i][1] = 50;
			String S = sc.next();
			long A = Long.parseLong(S.replace(".", ""));
			if(S.contains(".")) {
				int ten = S.length() - S.indexOf(".") - 1;
				int z = 0;
				for(int j = S.length()-1; j >= 0; j--) {
					if(S.charAt(j) == '0')
						z++;
					else
						break;
				}
				x[i][0] += ten-z;
				x[i][1] += ten-z;
				A /= Math.pow(10, z);
			}
			while(A % 5 == 0) {
				A /= 5;
				x[i][0]--;
			}
			while(A % 2 == 0) {
				A /= 2;
				x[i][1]--;
			}
			a[x[i][0]][x[i][1]]++;
		}
		for(int  i = 0; i < 99; i++)
			for(int j = 0; j < 99; j++)
				s[i+1][j+1] = s[i][j+1] + s[i+1][j] - s[i][j] + a[i][j];
		long ans = 0;
		for(int i = 0; i < N; i++) {
			if(x[i][0] <= 50 && x[i][1] <= 50)
				ans--;
			ans += s[100-x[i][0]+1][100-x[i][1]+1];
		}
		System.out.println(ans/2);
	}

}


Measured memory_bytes: 69488
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <climits>
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B, C;
    cin >> A >> B >> C;
    if(A <= C && C <= B){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}


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

int main(){
    int a;
    int b;

    cin >> a >> b ;
    if(a<b){
        printf("a < b\n");
    }else if(a>b){
        printf("a > b\n");
    }else{
        printf("a == b\n");
    }
    return 0;
}


Measured memory_bytes: 3052
#include<iostream>
#include<algorithm>
using namespace std;
typedef pair<long long,int> pli;
int main(){
  int n;
  cin>>n;
  long long a[n];
  pli p[n];
  for(int i=0;i<n;i++){
    scanf("%ld",&a[i]);
    p[i]=pli(a[i],i);
    }
  sort(p,p+n);
  reverse(p,p+n);
  long long ans[n];
  int mi=n;
  for(int i=0;i<n;i++)
    ans[i]=0;
  for(int i=0;i<n-1;i++){
    mi=min(mi,p[i].second);
    ans[mi]+=(i+1)*(p[i].first-p[i+1].first);
    }
  ans[0]+=n*p[n-1].first;
  for(int i=0;i<n;i++)
    printf("%ld\n",ans[i]);
  return 0;
  }

Measured memory_bytes: 4224
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a, b = map(int, readline().split())

ans = []
for i in range(a, b+1):
    if str(i) == str(i)[::-1]:
        ans.append(i)
print(len(ans))

Measured memory_bytes: 3060
a,b,c,d = map(int,input().split())

while(c>0 and d>0):
    c = c - b
    #print(c)
    if (c <= 0):
        print('Yes')
        break
    
    a = a - d 
    #print(a)
    if (a <= 0):
        print('No')
        break
    

Measured memory_bytes: 9104
import heapq
from collections import deque
from enum import Enum
import sys
import math
import datetime as kim
from _heapq import heappush, heappop
 
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
 
 
N = int(input())
not_prime = 0
 
for loop in range(N):
    num = int(input())
 
    if num%2 == 0:
        if num != 2:
            not_prime += 1
    else:
        for i in range(3,num,2):
            if i*i > num:
                break
            if num%i == 0:
                not_prime += 1
                break
 
print("%d"%(N-not_prime))


Measured memory_bytes: 6700
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
			　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <memory>
#include <iomanip>

#define rep(i, n) for(Int (i) = 0; (i) < (n); ++(i))
#define debug(var) std::cout << #var << ": " << var << "\n"
using Int = int64_t;
constexpr Int INF = INT_MAX;



void calc() {

	Int N; std::cin >> N;
	Int sum = 0;
	Int num = 0;
	while (1) {
		num++;
		if (num % 3 != 0 && num % 5 != 0) {
			sum += num;
		}
		if (num == N) {
			std::cout << sum;
			break;
		}
	}

}


int main() {

	calc();

	return 0;
}

Measured memory_bytes: 3564
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>

using namespace std;

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

#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 Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)
#define all(v) (v).begin(),(v).end()

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;

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

template <class T>
T gcd(T a, T b){
    if( b==0 ) return a;
    return gcd(b, a%b);
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

int INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

struct UnionFind{
private:
    vector<int> par;

public:
    UnionFind(int n=0): par(n,-1){ }

    int find(int x){
        if(par[x]<0) return x;
        else return par[x] = find(par[x]);
    }

    bool same(int x,int y){
        return find(x)==find(y);
    }

    bool unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x==y) return false;
        if(par[x]>par[y]) swap(x,y);
        par[x]+=par[y];
        par[y] = x;
        return true;
    }

    int size(int x){
        return -par[find(x)];
    }
};

int main(){
    int n,q;
    cin >> n >> q;
    UnionFind uf(n);
    rep(i,q){
        int com,x,y;
        cin >> com >> x >> y;
        if(com==0){
            uf.unite(x,y);
        }
        else{
            cout << uf.same(x,y) << endl;
        }
    }
}


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

#define INFTY 1000000001
int cnt = 0;

void merge(int A[], int left, int mid, int right) {
  int i, j, k;
  int n1, n2;  // 部分列L, Rの要素数決定に利用

  n1 = mid - left;
  n2 = right - mid;

  int L[n1+1], R[n2+1];

  for (i = 0; i < n1; i++) L[i] = A[left + i];
  for (i = 0; i < n2; i++) R[i] = A[mid + i];
  L[n1] = INFTY;
  R[n2] = INFTY;

  // sort
  j = 0;
  k = 0;
  for (i = left; i < right; i++) {
    if (L[j] <= R[k]) {
      A[i] = L[j];
      j++;
      cnt++;
    } else {
      A[i] = R[k];
      k++;
      cnt++;
    }
  }
}

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

int main() {
  int i, n, S[500000];

  cin >> n;
  for (i = 0; i < n; i++) cin >>  S[i];

  merge_sort(S, 0, n);

  for (i = 0; i < n; i++) {
    if (i > 0) cout << " ";
    cout << S[i];
  }
  cout << endl;
  cout << cnt << endl;

  return 0;
}



Measured memory_bytes: 6992
package main

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

func main() {
	sc := NewScanner()
	H, W := sc.NextInt(), sc.NextInt()
	S := make([][]byte, H)
	for i := 0; i < H; i++ {
		S[i] = []byte(sc.NextLine())
	}
	for i := 0; i < H; i++ {
		for j := 0; j < W; j++ {
			if S[i][j] == '.' {
				count := 0
				for a := -1; a <= 1; a++ {
					for b := -1; b <= 1; b++ {
						y := i + a
						x := j + b
						if y < 0 || y >= H || x < 0 || x >= W {
							continue
						}
						if S[y][x] == '#' {
							count++
						}
					}
				}
				S[i][j] = strconv.Itoa(count)[0]
			}
		}
	}
	for i := 0; i < H; i++ {
		fmt.Println(string(S[i]))
	}

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());
        var A = new List<int>();
        for (int i = 0; i < N; i++)
        {
            A.Add(int.Parse(Console.ReadLine()));
        }

        // 降順ソートする
        var maxList = new List<int>(A);
        maxList.Sort((a, b) => (b - a));

        // 先頭二つを保存
        var max = maxList[0];
        var subMax = maxList[1];

        for (int i = 0; i < N; i++)
        {
            if (A[i] == max) Console.WriteLine(subMax);
            else Console.WriteLine(max);
        }
    }
}



Measured memory_bytes: 45948
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

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

	vector<bool> arrives(b, false);

	int val = 0;
	while (1) {
		if (arrives[val]) {
			break;
		}
		arrives[val] = true;
		val = (val + a) % b;
	}

	cout << (arrives[c] ? "YES" : "NO") << endl;
	return 0;
}


Measured memory_bytes: 256
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = [ir() for _ in range(N)]
top = max(A)
if A.count(top) == 1:
    second = sorted(A, reverse=True)[1]
    for i in range(N):
        if A[i] == top:
            print(second)
        else:
            print(top)
else:
    for i in range(N):
        print(top)
# 23

Measured memory_bytes: 58816
#include <iostream> // cout, endl, cin
#include <iomanip>
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <numeric>
using namespace std;
#define _GLIBCXX_DEBUG
#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++)
const int INF = 1001001001;

int main()
{
    int N, Q;
    string S;
    cin >> N >> Q >> S;
    vector<int> l(Q), r(Q);
    rep(i, Q) cin >> l[i] >> r[i];

    vector<int> sum(N + 1);

    rep2(i, 1, N)
    {
        if (S.at(i - 1) == 'A' && S[i] == 'C')
        {
            sum[i + 1] = sum[i] + 1;
        }
        else
        {
            sum[i + 1] = sum[i];
        }
    }
    rep(i, Q)
    {
        int ans = sum[r[i]] - sum[l[i]];
        cout << ans << endl;
    }
}


Measured memory_bytes: 2176
#1:初期化
N = int(input())
a = []
r_append = a.append
for i in range(N):
    r_append(list(map(int,input().split())))
dp = [[0]*3 for _ in range (N+1)]
#print(dp, sep="\n")
#print(a, sep="\n")

#2:初期値(元からゼロなので記述無し)

#3:dp実行部(貰うDP)
for i in range(1,N+1):
    for j in range(3):
        for k in range(3):
            if(j == k):
                continue
            dp[i][j] = max(dp[i][j], dp[i-1][k]+a[i-1][j]) #dpは[1]からだが，aは[0]からに注意

#4:出力
dpmax = 0
for i in range(3):
    dpmax= max(dp[N][i], dpmax)
#print(*dp, sep="\n")
print(dpmax)


Measured memory_bytes: 47328
a=int(input())
b,c=map(int,input().split())
d=[]
for i in range(a):
	x=int(input())
	d.append(x)
sumx=c
j=0
while(j<a):
	k=1
	while(k<=b):
		sumx+=1
		k+=d[j]
	j+=1
print(sumx)


Measured memory_bytes: 3060
import sys

input = sys.stdin.readline


def main():
    S = input().rstrip()

    ans = 0
    n_black = 0
    for s in S:
        if s == "B":
            n_black += 1
        else:
            ans += n_black

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3500
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools

DIV_NUM = 1000000000 + 7

N,K = map(int, input().split())
A = [int(x) for x in input().split()]
if N==1:
    print(0)
    exit()

answer = 0
for i in range(len(A)):
    for j in range(len(A)-1,i,-1):
        if A[j]<A[j-1]:
            A[j],A[j-1] = A[j-1],A[j]
            answer += 1

q=0
p=A[0]
r=0
for i in range(1,N):
    if A[i]>p:
        p=A[i]
        r=i
    q += r

answer = answer % DIV_NUM
answer = (answer * K) % DIV_NUM
q = q % DIV_NUM
answer = answer + q * K * (K-1) // 2
answer = answer % DIV_NUM
print(answer)



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

int main(){
  int N, x;
  cin >> N >> x;
  vector<int> A(N);
  for(int i = 0; i < N; ++i){
    cin >> A[i];
  }
  long long int ans = 0;
  for(int i = 0; i < N-1; ++i){
    if(A[i] + A[i+1] > x){
      ans += min(A[i+1], (A[i] + A[i+1]) - x);
      A[i+1] -= min(A[i+1], (A[i] + A[i+1]) - x);
    }
    if(A[i] > x){
      ans += A[i] - x;
      A[i] -= x;
    }
  }
  cout << ans << endl;
  return 0;
}


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

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


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

using namespace std;

string fmt(int t) {
    char buf[10];
    sprintf(buf, "%02d:%02d:%02d", t/3600, t/60%60, t%60);
    return string(buf);
}

int main() {
    while(true) {
        int N;
        cin >> N;
        if(!N) break;

        vector<pair<int, int> > candidates;
        for(int i = 0; i < N; ++i) {
            int hands[3];
            int pat[] = {1, 60, 3600};
            cin >> hands[0] >> hands[1] >> hands[2];

            for(int r = 0; r < 60; ++r) {
                do {
                    int sec = 0;
                    int midx, hidx;

                    for(int j = 0; j < 3; ++j) {
                        if(pat[j] == 3600) hidx = j;
                        else if(pat[j] == 60) midx = j;

                        if(pat[j] == 3600) sec += hands[j] / 5 * pat[j];
                        else sec += hands[j] * pat[j];
                    }
                    if(hands[hidx] % 5 != hands[midx] / 12) continue;

                    candidates.push_back(make_pair(sec, i));
                } while(next_permutation(pat, pat+3));
                for(int k = 0; k < 3; ++k) {
                    hands[k] = (hands[k]+1) % 60;
                }
            }
        }

        sort(candidates.begin(), candidates.end());
        candidates.erase(unique(candidates.begin(), candidates.end()), candidates.end());

        vector<int> avail(N, 0);
        int availcnt = 0;
        int start = 0, end = candidates.size()-1;
        int cur_start = 0, cur_end = 0;
        for(int i = 0; i < candidates.size(); ++i) {
            int t = candidates[i].first;
            int watch = candidates[i].second;

            if(!avail[watch]++) availcnt++;

            while(avail[candidates[cur_start].second] > 1) {
                avail[candidates[cur_start].second]--;
                cur_start++;
            }

            cur_end = i;
            if(availcnt == N) {
                int d1 = candidates[cur_end].first - candidates[cur_start].first;
                int d2 = candidates[end].first - candidates[start].first;
                if(d1 >= 0 && d1 < d2) {
                    start = cur_start;
                    end = cur_end;
                    /*
                    cout << start << ' ' << end << endl;
                    for(int j = start; j <= end; ++j) {
                        cout << candidates[j].second << '(' << avail[candidates[j].second] << ')' << ' ';
                    }
                    cout << endl;
                    */
                }
            }
        }

        cout << fmt(candidates[start].first) << ' ' << fmt(candidates[end].first) << endl;
    }
    return 0;
}

Measured memory_bytes: 0
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	int[] A;
	boolean isBurst = false;

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		A = new int[3];
		String[] tokens = in.readLine().split(" ");
		for (int i = 0; i < 3; ++i) {
			A[i] = Integer.parseInt(tokens[i]);
		}
	}

	void calc() {
		int sum = 0;
		for (int i = 0; i < 3; ++i) {
			sum += A[i];
		}
		if (sum >= 22) {
			isBurst = true;
		}
	}

	void showResult() {
		System.out.println((isBurst ? "bust" : "win"));
	}
}


Measured memory_bytes: 21200
#include <algorithm>
#include <iostream>
#include <math.h>
#include <cstdio>
#include <string.h>
#include <vector>
#include <functional>
#include <stack>
#include <queue>
#include <string>
#include <list>
using namespace std;
typedef long long ll;
/* prototype */
int EDSum(ll);//各桁の和
vector<int> SOE(int,int);//素数 (Min,Max)
int MinCM(int,int);//最小公倍数(num1,num2)
int MaxCD(int,int);//最大公約数(num1,num2)
vector<int> igets(int);//cin * N
ll nPr(ll,ll); //(n,r)
ll nE(ll); //(n)
ll nCr(ll,ll); //(n,r)

void solve(){
    //START
  	int A,B;
  	cin >> A >> B;
  	if(A==1)A=50;
  	if(B==1)B=50;
  	if(A==B)  
  		cout << "Draw" << endl;
	else if(A<B)
      	cout << "Bob" << endl;
  	else cout << "Alice" << endl;
}

int main(void){cin.tie(0);ios::sync_with_stdio(false);solve();}
/*FUNC*/
//各桁の和
int EDSum(ll number){
    int ans=0;
    while(1){
        ans += number % 10;
        number /= 10;
        if(number == 0) break;
    }
    return ans;
}

//エラトステネスのふるい(素数発見アルゴリズム)
vector<int> SOE(int min, int max)
{
    //0,1は含まれない
    if (min < 2) min = 2;
    //探索リスト作成
    vector<int> int_array;
    for (int i = min; i <= max; i++) int_array.push_back(i);
    //素数リスト
    vector<int> sosu;
    //√max
    double stop = sqrt(max);
    //計算
    while (true)
    {
        //素数リストに追加
        sosu.push_back(int_array.front());
        int_array.erase(int_array.begin());
        //停止
        if (stop < (double)(sosu.back())) break;
        //ふるい
        for (int i = 0; i < (int)int_array.size(); i++)
        {
            if (int_array[i] % sosu.back() == 0)
                int_array.erase(int_array.begin() + i);
        }
    }
    sosu.insert(sosu.end(), int_array.begin(), int_array.end());
    return sosu;
}

//最小公倍数
int MinCM(int a, int b)
{
    int c = a * b;
//入れ替え
    if (a < b)
        swap(a, b);
    int r = a % b;
    while (r != 0)
    {
        a = b;
        b = r;
        r = a % b;
    }
    return c / b;
}

//最大公約数
int MaxCD(int a, int b)
{
//入れ替え
    if (a < b)
        swap(a, b);
    int r = a % b;
    while (r != 0)
    {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}
//iget cin int 2 vector
vector<int> igets(int N){
    vector<int> A;
    int temp;
    for (int i = 0; i < N; ++i) {
        cin >> temp;
        A.push_back(temp);
    }
    return A;
}

ll nPr(ll n,ll r) {
    ll ans=1;
    r=n-r;
    while(n!=r) {
        ans*=n;
        --n;
    }
    return ans;
}

ll nE(ll n) {
    return nPr(n,n);
}

ll nCr(ll n,ll r) {
    if(r==0)return -1;
    else{
        if(0!=n-r&&n-r<r)r=n-r;
        return nPr(n,r)/nE(r);
    }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int D; cin >> D;
    cout << "Christmas";
    rep(i, 25 - D) cout << " Eve";
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int H,W;
  cin>>H>>W;
  vector<vector<char>> vvc;
  vvc=vector<vector<char>>(H,vector<char>(W));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin>>vvc[i][j];
    }
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<2;j++){
      for(int k=0;k<W;k++){
        cout<<vvc[i][k];
      }
      cout<<endl;
    } 
  }
}

Measured memory_bytes: 256
//Sinhaeng Hhjian
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
const int maxn=5e6+7;
typedef long long ll;
int n, a[maxn], sum;
int main(){
	scanf("%d", &n);
	for(int i=0;i<n;i++)
		scanf("%d", &a[i]);
	sort(a, a+n);
	int ans=0;sum=0;
	if(a[0]%2)
		sum=n;
	for(int i=1;i<n;i++){
		int x=a[i]-a[i-1];
		if(x%2)
			sum^=(n-i);
	}
	for(int i=0;i<n;i++)
		if(n-i>(sum^(n-i)))
			ans++;
	if(ans)
		printf("first\n");
	else
		printf("second\n");
	return 0;
}

Measured memory_bytes: 640
// In the name of God
#include <bits/stdc++.h>

using namespace std;
#define Size(x) ((int)(x).size())
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int,int>pii;
const int INF = 1e9 + 10;

int main()
{
	ios_base :: sync_with_stdio(false) ,cin.tie(0) , cout.tie(0);
	int a;cin>>a;
	ll p = 0;
	int i;
	for(i=1;p<a;++i)
		p += i;
	cout << i-1 << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } else return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } else return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll INF = 1e9+100;
const ll INFL = 1e18+100;
const ll MOD = 1e9+7;
const bool debug = 0;

int main() {
	int A[3];
	REP(i, 3) cin >> A[i];
	sort(A, A + 3);
	cout << A[2] - A[0] << endl;
}

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

const int MOD = 1e9 + 7;

inline int mul (int a, int b) {
  return (a * 1LL * b) % MOD;
}

int main() {
  int n;
  cin >> n;
  vector<int> cnt(3, 0);
  int ans = 1;
  for (int i = 0; i < n; i++) {
    int a, c = 0, id = -1;
    cin >> a;
    for (int j = 0; j < 3; j++) {
      if (a == cnt[j]) {
        ++c;
        id = j;
      }
    }
    if (id == -1) {
      cout << 0 << endl;
      return 0;
    }
    ans = mul(ans, c);
    ++cnt[id];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class Main{
    public static void main(String[] args) {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String line = null;
        String[] in = null;
        int numBuy, numIn;
        ArrayList<Integer> costVegitables = new ArrayList<>();

        try {
            while((line = input.readLine()) != null){
                in = line.split(" ");
                if(in[0].equals("0") && in[1].equals("0")){
                    break;
                }
                numBuy = Integer.parseInt(in[0]); numIn = Integer.parseInt(in[1]);

                line = input.readLine();
                in = line.split(" ");
                costVegitables.clear();
                for(String str : in){
                    int cost = Integer.parseInt(str);
                    costVegitables.add(cost);
                }
                Collections.sort(costVegitables, Collections.reverseOrder());

                int index = 1;
                int minimumCost = 0;                
                for(int i: costVegitables){
                    if(index%numIn != 0){
                        minimumCost += i;
                    }
                    index++;
                }
                System.out.println(minimumCost);
            }
        } catch (IOException e) {
            System.out.println("IOException");
        } catch (NumberFormatException e){
            System.out.println("including not int");
        }
    }
}


Measured memory_bytes: 33676
#include <stdio.h>

int main(void){
  long long k,a,b;
  int mod;
  scanf("%lld%lld%lld",&k,&a,&b);
  if(a+2>=b){
    printf("%lld",k+1);
    return 0;
  }
  k=k-a+1;
  mod=k%2;
  if(mod==1){
    printf("%lld",a+(b-a)*(k-1)/2+1);
  }
  if(mod==0){
    printf("%lld",a+(b-a)*k/2);
  }

  return 0;
}


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

int main(void) {
  
  int n;
  int *ret;
  scanf("%d", &n);
  ret = calloc(n, sizeof(int));
  for (int i = 1; i < n; i++)
  {
    int a;
    scanf("%d", &a);
    ret[a-1]++;
  }
  for (int i = 0; i < n; i++)
  {
    printf("%d\n", ret[i]);
  }
  
  

  return 0;
}

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

#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()

using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;

const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

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

	int n;
	cin >> n;
	cout << (n - 2) * 180 << "\n";

    return 0;
}


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

using namespace std;

#ifdef KACTL
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define sz(x) (int)(x).size()
#endif
#define all(x) begin(x), end(x)

using ll = int64_t;
using ld = long double;
using pii = pair<int32_t, int32_t>;
using vi = vector<int32_t>;

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

    int n;
    cin >> n;
    vector<string> s(n);
    for (auto& x : s)
        cin >> x;
    sort(all(s));
    s.erase(unique(all(s)), end(s));

    cout << s.size();

    return 0;
}


Measured memory_bytes: 9540
import collections
w = input()
W = list(w)
S = collections.Counter(W)
a = list(S.values())
n = 0
for i in range(len(a)):
    if (a[i] % 2) ==1:
        n = n + 1
if n == 0:
    print("Yes") 
else:
    print("No")

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

using namespace std;

int main(void){

  int a, b;

  cin >> a >> b;

  if (a < b){
    cout << "a < b" << endl;
  }
  else if (a > b){
    cout << "a > b" << endl;
  }
  else {
    cout << "a == b" << endl;
  }
}




Measured memory_bytes: 3108
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array;


void main() {
    readln.split.to!(int[]).reduce!"(a + b) % 24".writeln;
}



void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


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


int main() {

    int N;
    long long int X;

    cin >> N;

    vector<long long int> A(N);

    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }

    std::sort(A.begin(), A.end());
    A.erase(std::unique(A.begin(), A.end()), A.end());

    string result = "YES";

    if (N != A.size()) result = "NO";

    
    cout << result << endl;
    
    return 0;
}

Measured memory_bytes: 1792
#![allow(unused_imports)]

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

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

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

use std::{i32, i64, u32, u64, usize, f64};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::io::{stdout, Write, BufWriter};
use std::mem::{swap};

fn main() {
    input! {
        n: usize,
        hs: [usize; n],
    }
    let mut ans = 0usize;
    solve(&mut ans, &hs);
    println!("{}", ans);
}

fn solve(ans: &mut usize, hs: &[usize]) {
    match hs.iter().min() {
        Some(&m) => {
            if hs.iter().all(|h| *h == 0) {
                return;
            }
            *ans += m;
            let hss: Vec<_> = hs.iter().map(|h| h - m).collect();
            for hs in hss.split(|&h| h == 0) {
                solve(ans, hs);
            }
        },
        None => { return; },
    }
}


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

using namespace std;

int main()
{
    int n,x;
    while(~scanf("%d",&n))
    {
        int m4=0,m2=0,m1=0;
        for(int i=0;i<n;i++)
        {
            scanf("%d",&x);
            if(x%4==0)m4++;
            else if(x%2==0)m2++;
            else m1++;
        }
        if(m1>m4+1||(m1==m4+1&&m2!=0))printf("No\n");
        else printf("Yes\n");
    }
    return 0;
}


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

class Main {

    public static void main(String[] args) throws Exception {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            int trainFeeOfTicketForOnce = Integer.parseInt(br.readLine());
            int trainFeeOfUnlimitedRide = Integer.parseInt(br.readLine());
            int busFeeOfTicketForOnce = Integer.parseInt(br.readLine());
            int busFeeOfUnlimitedRide = Integer.parseInt(br.readLine());

            int selectedTrainFee = selectFee(trainFeeOfTicketForOnce, trainFeeOfUnlimitedRide);
            int selectedBusFee = selectFee(busFeeOfTicketForOnce, busFeeOfUnlimitedRide);
            int selectedTransportationFee = selectedTrainFee + selectedBusFee;

            System.out.println(selectedTransportationFee);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }

    private static int selectFee(int ticketForOnce, int unlimitedRide) {
        int selectedFee = ticketForOnce;
        if (ticketForOnce > unlimitedRide) {
            selectedFee = unlimitedRide;
        }

        return selectedFee;
    }
}

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

#define len length()
#define sz size()
#define rep(i, n) for(int i = 0; i < n; i++)
#define srt(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define veci(a, n) vector<int> a(n)
#define vecs(a, n) vector<string> a(n)
#define vecc(a, n) vector<char> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define sp(n) cout << setprecision(n) << fixed
#define fst(s) s.at(0)
#define lst(s) s.at(s.len - 1)

int main(){
    int N;
    cin >> N;
    vecc(S, N);
    rep(i, N) cin >> S[i];

    string ans = "Three";
    rep(i, N) if(S[i] == 'Y') ans = "Four";

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <list>

using namespace std;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

struct Point{
	int x, y;
	int num;
};

struct Node{
	int l, r;
	int location;
};

bool sortByX(const Point &left, const Point &right){
	return left.x < right.x;
}

bool sortByY(const Point &left, const Point &right){
	return left.y < right.y;
}

#define MAX_N 510000
#define NIL (-1)

Point P[MAX_N];
Point P_[MAX_N];
Node T[MAX_N];
int np;

int make2DTree(int l, int r, int depth){
	if(l >= r){
		return NIL;
	}
	int mid = (l + r) / 2;
	int t = np++;
	
	if(depth % 2 == 0){
		sort(P + l, P + r, sortByX);
	}else {
		sort(P + l, P + r, sortByY);
	}
	
	T[t].location = mid;
	T[t].l = make2DTree(l, mid, depth + 1);
	T[t].r = make2DTree(mid + 1, r, depth + 1);
	
	return t;
}

void find(int v, int sx, int tx, int sy, int ty, int depth, vector<int> &ans){
	Point p = P[T[v].location];
	int x = p.x;
	int y = p.y;
	int num = p.num;
	
	if(sx <= x && x <= tx && sy <= y && y <= ty){
		ans.push_back(num);
	}
	
	if(depth % 2 == 0){
		if(T[v].l != NIL && sx <= x){
			find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
		}
		if(T[v].r != NIL && x <= tx){
			find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
		}
	}
	else {
		if(T[v].l != NIL && sy <= y){ 
			find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
		}
		if(T[v].r != NIL && y <= ty){
			find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
		}
	}
}

int main(){
	
	while(true){
		
		int An, Bn, R;
		cin >> An >> Bn >> R;
		R *= 4;
		
		if(An == 0){
			break;
		}
		
		for(int i = 0; i < An; i++){
			scanf("%d %d", &P[i].x, &P[i].y);
			P_[i].x = P[i].x;
			P_[i].y = P[i].y;
			P[i].num = i;
			T[i].l = T[i].r = T[i].location = NIL;
		}
		
		np = 0;
		int root = make2DTree(0, An, 0);
		int ans = 0;
		
		for(int i = 0; i < Bn; i++){
			int cx, cy;
			scanf("%d %d", &cx, &cy);
			
			vector<int> ret;
			find(root, cx - R, cx + R, cy - R, cy + R, 0, ret);
			
			for(int j = 0; j < ret.size(); j++){
				int dx = P_[ret[j]].x - cx;
				int dy = P_[ret[j]].y - cy;
				if(dx * dx + dy * dy <= R * R){
					ans += 1;
				}
			}
		}
		cout << ans << endl;
	}
	
	return 0;
}



Measured memory_bytes: 6684
N = int(input())
A = list(map(int, input().split()))

count = 0
while(True):
    b = list(map(lambda x: x%2 != 0, A))
    if True in b:
        break

    A = list(map(lambda x: x/2, A))
    count += 1
    
print(count)
    

Measured memory_bytes: 2940
# C - Low Elements
def main():
    N, *P = map(int, open(0).read().split())
    ans, cur_min = 0, P[0]
    for i in P:
        if i <= cur_min:
            ans += 1
        cur_min = min(cur_min, i)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 25116
import sys
import numpy as np
N = int(input())
D = list(map(int,input().split()))
M = max(D)
countlist=[0] * (M + 1)
ans=1

for i in D:
    countlist[i]+=1

if countlist[0]!=1 :
    print(0)
    sys.exit()
elif M<2:
    print(1)
    sys.exit()

if D[0]!=0 :
    print(0)
    sys.exit()

for i in range(2,M+1):
        ans *= countlist[i-1]**countlist[i]

print(ans%998244353) 

Measured memory_bytes: 32220
#include <stdio.h>

int main()
{
    int a, b, d, r;
    double f;
    
    scanf("%d %d", &a, &b);
    
    d = a/b;
    r = a%b;
    f = (double)a/(double)b;
    
    printf("%d %d %f\n", d, r, f);
    return 0;
}

Measured memory_bytes: 636
h,w=map(int,input().split())
a=[]
for i in range(h):
    a.append(list(map(int,input().split())))

ans=[]
for i in range(h):
    for j in range(w):
        if(j==w-1 and i!=h-1 and a[i][j]%2!=0):
            a[i][j]-=1
            a[i+1][j]+=1
            ans.append([i+1,j+1,i+2,j+1])
        elif(j<w-1 and a[i][j]%2!=0):
            a[i][j]-=1
            a[i][j+1]+=1
            ans.append([i+1,j+1,i+1,j+2])

print(len(ans))
for i in range(len(ans)):
    print(*ans[i])


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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using pii = pair<int, int>;
using vi = vector<int>;
using lint = long long;

const int inf = 1001001001;
const lint linf = 1001001001001001001ll;
const int mod = 1e9 + 7;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};

template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; } return a > b; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; } return a < b; }
template<typename T> inline void print(const T &x, string s = "\n") { cout << x << s; }
template<typename T> inline void print(const vector<T> &v, string s = " ")
{ if (!v.size()) puts(""); rep(i, v.size()) cout << v[i] << (i + 1 == v.size() ? "\n" : s); }
inline bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }
inline lint in() { lint x; std::cin>>x; return x; }

struct UnionFind {
	vector<int> p, r;

	UnionFind() {}
	UnionFind(int size) { init(size); }

	void init(int size) {
		p.resize(size);
		r.resize(size);
		for (int i = 0; i < size; ++i) {
			p[i] = i; r[i] = 1;
		}
	}

	int root(int x) {
		if (p[x] == x) return x;
		else return p[x] = root(p[x]);
	}

	void unite(int x, int y) {
		x = root(x); y = root(y);

		if (x == y) return;

		if (r[x] > r[y]) swap(x, y);
		r[x] += r[y];
		p[y] = x;
	}

	bool is_root(int x) {
		return root(x) == x;
	}

	bool same(int x, int y) {
		return root(x) == root(y);
	}

	int element_count(int x) {
		x = root(x);
		return r[x];
	}
};

signed main() {
  int h, w;
  while (cin >> w >> h, w) {
    char c[30][30];
    rep(i, 30) rep(j, 30) c[i][j] = '#';

    for (int i = 1; i <= h; ++i) {
      for (int j = 1; j <= w; ++j) {
        cin >> c[i][j];
      }
    }

    UnionFind uf(h * w + 200);

    int s = -1;

    for (int i = 1; i <= h; ++i) {
      for (int j = 1; j <= w; ++j) {
        if (c[i][j] == '#') continue;
        if (c[i][j] == '@') {
          s = i * w + j;
        }

        int v = i * w + j;

        rep(k, 4) {
          int y = i + dy[k];
          int x = j + dx[k];
          if (c[y][x] == '#') continue;

          int u = y * w + x;

          uf.unite(u, v);
        }
      }
    }

    cout << uf.element_count(s) << endl;
  }
}

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

inline long long read(){
    long long s = 0, w = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9'){
        if (ch == '-') w = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9'){
        s = s * 10 + ch - '0';
        ch = getchar();
    }
    return s * w;
}

int n, a[333];
long long ans;

int main(){
    n = read();
    for (int i = 1; i <= n; i++)
        a[i] = read();
    for (int i = 1; i <= n; i++)
        for (int j = i + 1; j <= n; j++)
            for (int k = j + 1; k <= n; k++)
                if (a[i] != a[j] && a[j] != a[k] && a[k] != a[i])
                    if (a[i] + a[j] > a[k] && a[i] + a[k] > a[j] && a[j] + a[k] > a[i])
                        ans++;
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
#include <algorithm>
typedef long long ll;
using namespace std;
const int MAX = 1e5 + 5;
long long arr[MAX];

ll gcd(ll a,ll b)
{   if(b==0)
        return a;
    else if(a==0)
        return b;
    else if(a==1 || b==1)
        return 1;
    else if(a < b)
        return gcd(a,b%a);
    else
        return gcd(b,a%b);

}

int main()
{
    ll n ,k;
    ll G=0;
    ll M=INT_MIN;
    scanf("%lld %lld",&n,&k);
    for(ll i=0;i<n;i++)
    {
        scanf("%lld",&arr[i]);
        G = gcd(G,arr[i]);
        M = max(M,arr[i]);

    }
    if(!(k%G) && (k<=M))
        cout<<"POSSIBLE"<<"\n";
    else
        cout<<"IMPOSSIBLE"<<"\n";


}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <climits>
#include <functional>
#include <map>
#include <stack>
#include <cstdlib>
#define endl '\n'
#define ll long long
#define NCONS 100001

using namespace std;

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    int X, A, B; cin >> X >> A >> B;
    X -= A;
    cout << X % B << endl;
    
    
    return 0;
}


Measured memory_bytes: 256