akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main()
{
	int N;
	int A[222];
	scanf("%d",&N);
	int i;
	for(i=0;i<=N-1;i++)
		scanf("%d",&A[i]);
	int sisuu[222] = {0};
	for(i=0;i<=N-1;i++){
		while(A[i]%2 == 0){
			sisuu[i]++;
			A[i] = A[i] / 2;
		};
	};
	int min = sisuu[0];
	for(i=1;i<=N-1;i++){
		if(min > sisuu[i])	min = sisuu[i];
	};
	printf("%d",min);
		
	
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int abs(int x, int y) {
  if (x < y) {
    return y-x;
  }
  else{
    return x-y;
  }
}
int main(){
  int N;
  cin >>N;
  vector<int> H(N);
  for(int i =0;i<N; i++){
    cin >> H.at(i);
  }
  int count = 1;
  for(int i =1;i<N;i++){
    bool anal= true;
    for(int j =0;j<i ;j++){
      if(H.at(i) <H.at(j)){
        anal = false;
      }
    }
    if(anal){
      count ++;
    }
  }
  cout <<count <<endl;

  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

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

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<LL,LL>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    LL from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};
int main(){
    CIN(N);
    I vec;
    I s;
    int ins = 0;
    int w = 1;
    int ans = 0;
    CIN(c);
    ins = c;
    REP(a,N-1){
        CIN(b);
        if(b == ins){
            w++;
        }else{
            ans += w/2;
            ins = b;
            w=1;
        }
    }
    ans += w /2;
    COUT(ans);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int a,b,c;
  scanf("%d %d %d", &a, &b, &c);
  int soma = a+b+c;

  if(soma < 22){
    printf("win\n");
  }
  else{
    printf("bust\n");
  }
  return 0;
}


Measured memory_bytes: 128
n,m,c = map(int,input().split())
b = [int(x) for x in input().split()]
ans = 0
for s in range(n):
    a = [int(x) for x in input().split()]
    scr = sum([a[i]*b[i] for i in range(m)]) + c
    if scr > 0:
        ans += 1
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    string s;
    cin >> s;
    cout << (s[2] == s[3] && s[4] == s[5]?"Yes":"No");    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int m,f,r; //m:??????,r:??????,f:??????
	while(1){
		scanf("%d %d %d",&m,&f,&r);
		if(m==-1&&f==-1&&r==-1){
			break;
		}
		if(m==-1 || f==-1){
			printf("F\n");
		}
		else if(m+f>=80){
			printf("A\n");
		}
		else if(m+f>=65){
			printf("B\n");
		}
		else if(m+f>=50 || (m+f<50&&r>=50)){
			printf("C\n");
		}
		else if(m+f>=30){
			printf("D\n");
		}
		else{
			printf("F\n");
		}
	}
	return 0;
}

Measured memory_bytes: 584
import math
import fractions


# i番目の要素をxに変更する
def update(i, x, list_len, seg):
    # リストのi番目の要素がsegの何番目なのかを求める
    # リスト長4で1番目の要素はsegtree中では4+1-1=4番目
    i = list_len + i - 1
    seg[i] = x
    while i > 0:
        i = math.floor((i-1)/2)  # 上のノード
        # 子ノードを元に更新（GCD,MAX,MIN）
        seg[i] = fractions.gcd(seg[2*i + 1], seg[2*i + 2])
    # 頂点を返す
    # print(seg)
    return seg[0]


n = int(input())
a = list(map(int, input().split()))
segtree = [0] * (2*len(a) - 1)  # segtreeは2n-1個
for i in range(n):
    update(i, a[i], n, segtree)

maxi = 0
for i in range(n):
    maxi = max(maxi, update(i, 0, n, segtree))
    update(i, a[i], n, segtree)

print(maxi)


Measured memory_bytes: 90080
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#include<string>
#include<sstream>
using namespace std;
int inf = 1e9;
int main(){
  int n;
  cin >> n;
  map<string, int> mp;
  for(int i=0; i<n; i++){
    string s;
    cin >> s;
    mp[s]++;
  }
  int m;
  cin >> m;
  for(int i=0; i<m; i++){
    string s;
    cin >> s;
    mp[s]--;
  }
  int ans = 0;
  for(auto i=mp.begin(); i!=mp.end(); i++){
    cerr << i->first << " " << i->second << endl;
    ans = max(ans, i->second);
  }
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 256
def fast_bellman_ford(n, s, graph, init_val): #どう？
    d = [init_val] * n
    d[s] = 0
    from_set = {s}
    for _ in range(n):
        next_set = set()
        for vf in from_set:
            for vt, w in graph[vf]:
                if d[vt] > d[vf] + w:
                    d[vt] = d[vf] + w
                    next_set.add(vt)
        from_set = next_set
        if not from_set:
            break
    if from_set: #閉路の存在
        while from_set:
            minus_inf = -float('inf')
            next_set = set()
            for vf in from_set:
                for vt, w in graph[vf]:
                    if d[vt] > d[vf] + w:
                        d[vt] = minus_inf
                        next_set.add(vt)
            from_set = next_set
    return d

n, m = map(int, input().split())
graph = [[] for _ in range(n)]
for i in range(m):
    a, b, w = map(int, input().split())
    graph[a-1].append((b-1, -w))
d = fast_bellman_ford(n, 0, graph, float('inf'))
print(-d[-1] if d[-1] != -float('inf') else 'inf')






Measured memory_bytes: 70604
n,m = map(int, input().split())
par = [0]*(n+1)
group = [1]*(n+1)
for i in range(1,n+1): par[i]=i
def root(x):
  if par[x]==x: return x
  return root(par[x])

def union(x,y):
  rx = root(x)
  ry = root(y)
  if rx==ry: return
  par[max(rx,ry)] = min(rx,ry)
  group[min(rx,ry)] += group[max(rx,ry)]

for _ in range(m):
  f1,f2 = map(int, input().split())
  union(f1,f2)
print(max(group))

Measured memory_bytes: 83760
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Vector.Unboxed.Mutable (IOVector, STVector)
import qualified Data.Vector.Unboxed.Mutable as VM

main :: IO ()
main = solve <$> readLn >>= print

solve :: Int -> Int
solve x = runST $ do
  dp <- VM.replicate 100001 0 :: ST s (STVector s Int)
  VM.write dp 0 1
  forM_ [100 .. 105] $ \i -> do
    forM_ [0 .. 100000] $ \j -> do
      y <- VM.read dp j
      when (y == 1 && i + j <= 100000) $ VM.write dp (i + j) 1
  r <- VM.read dp x
  return r


Measured memory_bytes: 13060
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <cstring>
#include <cctype>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <complex>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for(int i = a; i < (int)b; i++)
const int INF = 1<<28;
const string al = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

int main() {
	int n;
	while(cin >> n, n) {
		int k[n];
		REP(i, n) cin >> k[i];
		string s; cin >> s;
		int k2[s.size()];
		REP(i, s.size()) {
			size_t p = al.find(s[i]);
			k2[i] = (int)p;
		}
		REP(i, s.size())
			cout << al[(k2[i] - k[i%n] + 52) % 52];
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
#include <stdio.h>

long min(long x, long y){
  if (x<y) return x;
  else     return y;
}

int main(){
   long n,a,b,aa,bb,m1,m2;
 
   scanf("%ld %ld %ld",&n,&a,&b);
   if ((b-a)%2==0)   printf("%ld\n",(b-a)/2);
   else {
      aa=a;bb=b;
      m1=a-1;a=1;b=b-m1;
      if ((b-a)%2==0) m1+=(b-a)/2;
      else            m1+=(b-a+1)/2;
      m2=n-bb;bb=n;aa=aa+m2;
      if ((bb-aa)%2==0) m2+=(bb-aa)/2;
      else              m2+=(bb-aa+1)/2;
      printf("%ld\n",min(m1,m2));
   }
   return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
typedef long long ll;

int main(){
  ll a;
  while(cin >> a,a){
    ll ans = 0, k=1;
    while(a){
      ll b = 10*(a%10<0);
      ans+=(b+a%10)*k;
      (a-=b)/=-10; k*=10;
    }
    cout << ans << endl;
  }    
}

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

using namespace std;

namespace {

// BubbleSort sorts the array |a| in ascending order, and then returns
// the number of swap operations.
int BubbleSort(int* a, int n) {
  int nswap = 0;
  bool flag = true;
  while (flag) {
    flag = false;
    for (int j = n - 1; j >= 1; --j) {
      if (a[j] < a[j - 1]) {
        const int t = a[j - 1];
        a[j - 1] = a[j];
        a[j] = t;
        ++nswap;
        flag = true;
      }
    }
  }
  return nswap;
}

void Print(const int* a, int n) {
  for (int i = 0; i < n; ++i) {
    if (i > 0) printf(" ");
    printf("%d", a[i]);
  }
  printf("\n");
}

} // namespace

int main() {
  int n;
  cin >> n;
  int a[100];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }

  const int r = BubbleSort(a, n);
  Print(a, n);
  cout << r << endl;
  return 0;
}

Measured memory_bytes: 1196
from collections import Counter
inputs = open(0).readlines()
n = int(inputs[0])
*A, = (map(int, inputs[1].split()))
B = Counter([a+i for i, a in enumerate(A, 1)])
C = Counter([i-a for i, a in enumerate(A, 1)])
ans = 0
for k, v in B.items():
    if k in C:
        ans += C[k]*v
print(ans)

Measured memory_bytes: 63048
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int inf = 0x3f3f3f3f,oo = inf;
#define pi 3.14159265358979323846
#define IL inline
#define RG register
#define rep(i,a,b) for(RG int i=(a);i<(b);++i)
#define Rep(i,a,b) for(RG int i=(a);i<=(b);++i)
#define Dep(i,a,b) for(RG int i=(a);i>=(b);--i)
#define pc putchar
/*char __wzp[1<<15|1],*__S=__wzp+32768;
#define gc() (__S>=__wzp+32768?(__wzp[fread(__wzp,sizeof(char),1<<15,stdin)]=EOF),*((__S=__wzp)++):*(__S++))*/
#define gc getchar
IL ll read(){
    RG ll x=0;char f=0;RG char c=gc();
    for(;!isdigit(c);c=gc())f|=(c=='-');
    for(;isdigit(c);c=gc())x=(x<<1)+(x<<3)+(c^48);
    return f?-x:x;
}
IL double readdb(){
    RG double x=0,p=0.1;RG char f=0,c=gc();
    for(;!isdigit(c);c=gc())f|=(c=='-');
    for(;isdigit(c);c=gc())x=x*10+(c^48);
    if(c=='.')for(c=gc();isdigit(c);c=gc(),p/=10)x=x+(c^48)*p;
    return f?-x:x;
}
IL void write(ll x){if(x<0)x=-x,pc('-');if(x>=10)write(x/10);pc(x%10+'0');}
IL void writeln(ll x){write(x);puts("");}
IL void writeln(ll x,char c,ll y){write(x);pc(c);writeln(y);}
IL void writeln(ll x,char c,ll y,char d,ll z){write(x);pc(c);write(y);pc(d);writeln(z);}
#define debug(x) printf(#x" = %d\n",x);
#define rd() read()
#define rdb() readdb()
#define mem(x,v) memset(x,v,sizeof(x))
#define pb push_back
#define mp make_pair
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-(x)))
#define fin(x) freopen(#x".in","r",stdin)
#define fout(x) freopen(#x".out","w",stdout)
#define y1 ____y1
#define hash __hash
#define union _union
const int maxn = 100500;
int sg[maxn],n,m;
vector<int> edge[maxn];
void dfs(int u,int fa){
	sg[u] = 0;
	for(unsigned i=0;i<edge[u].size();++i){
		int v = edge[u][i];
		if(v ==fa) continue;
		dfs(v,u);
		sg[u] ^= (sg[v] + 1);
	}
}
int main(){
	n = rd();
	Rep(i,1,n) edge[i].clear();
	rep(i,1,n){
		int a = rd(),b = rd();
		edge[a] . push_back(b);
		edge[b] . push_back(a);
	}
	dfs(1,0);
	puts(sg[1] ? "Alice" : "Bob");
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

int main() {
  string s;
  std::cin >> s;
  int n = s.size();
  std::vector<int64_t> v(n + 1, 0);

  rep(i, n) {
    if (s[i] == '<') {
      v[i + 1] = v[i] + 1;
    }
  }

  for (int i = n - 1; i >= 0; i--) {
    {
      if (s[i] == '>') {
        v[i] = max(v[i], v[i + 1] + 1);
      }
    }
  }

  int64_t ans = 0;
  for (int i = 0; i <= n; i++) {
    ans += v[i];
  }

  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 7692
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;

int main(){
  int year,month,day,n,d=0;
  cin>>n;
  for(int i = 0;i<n;i++){
    cin>>year>>month>>day;
    d = 0;
    while(year != 1000){
      day++;
      d++;
      if(year%3 == 0){
	if(day > 20){
	  day = 1;
	  month++;
	}
	if(month > 10){
	  year++;
	  month = 1;
	}
      }else{
	if(month%2 == 0){
	  if(day > 19){
	    day = 1;
	    month++;
	  }
	  if(month > 10){
	    year++;
	    month = 1;
	  }
	}else{
	  if(day > 20){
	    day = 1;
	    month++;
	  }
	  if(month > 10){
	    year++;
	    month = 1;
	  }
	}
      }
      if(year ==  1000)cout<<d<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1160
MOD = 10 ** 9 + 7
table_len = 2 * 10 ** 6 + 10

fac = [1, 1]
for i in range(2, table_len):
    fac.append(fac[-1] * i % MOD)
    
finv = [0] * table_len
finv[-1] = pow(fac[-1], MOD - 2, MOD)
for i in range(table_len-1, 0, -1):
    finv[i-1] = finv[i] * i % MOD

def comb(a, b):
    return fac[a+b] * finv[a] * finv[b] % MOD


r1, c1, r2, c2 = map(int, input().split())
ans = (comb(r1, c1) + comb(r2+1, c2+1) - comb(r1, c2+1) - comb(r2+1, c1)) % MOD
print(ans)

Measured memory_bytes: 205676
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int n;
	scanf("%d",&n);
	printf("%d\n", 180 * (n - 2));
	return 0;
}


Measured memory_bytes: 128
import heapq

N = int(input())
a_list = list(map(int, input().split()))

max_score = - float("inf")

red_list = a_list[:N]
blue_list = [-a for a in a_list[2 * N:]]
heapq.heapify(red_list)
heapq.heapify(blue_list)
red_sum = [sum(red_list)]
blue_sum = [sum(blue_list)]

for i in range(N, 2 * N):
    heapq.heappush(red_list, a_list[i])
    item = heapq.heappop(red_list)
    red_sum.append(max(red_sum[-1], red_sum[-1] + a_list[i] - item))

for i in range(2 * N - 1, N - 1, -1):
    heapq.heappush(blue_list, -a_list[i])
    item = heapq.heappop(blue_list)
    blue_sum.append(max(blue_sum[-1], blue_sum[-1] - a_list[i] - item))

for i in range(N+1):
    score = red_sum[i] + blue_sum[-(i + 1)]
    if max_score < score:
        max_score = score
print(max_score)


Measured memory_bytes: 37212
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;

public class Main {

	static BufferedReader reader;
	final static boolean MODE_DEBUG = false;
	//static field here
	final static String[] c = new String[]{"ABC","ARC"};
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		reader = new BufferedReader(new InputStreamReader(System.in));
		//code here
		String S = readLine()[0];
		if(S.equals(c[0])) {print(c[1]);}
		if(S.equals(c[1])) {print(c[0]);}
		//String[] s = readLine();
		//print(num);
	}
	
	//functions here
	//note that all methods should be STATIC


	private static <T> int arraySearch(T needle, T[] heystack) {
		for(int i=0;i<heystack.length;i++) {
			if(needle.equals(heystack[i])) {
				return i;
			}
		}
		return -1;
	}
	private static int[] sort(int[] base) {
		int[] copy = array_copy(base);
		Arrays.sort(copy);
		return copy;
	}
	private static int[] array_copy(int[] base) {
		int[] copy = new int[base.length];
		for(int i=0;i<base.length;i++) {
			copy[i] = base[i];
		}
		return copy;
	}
	private static int[] asArray(ArrayList<Integer> ints) {
		int[] intlist = new int[ints.size()];
		for(int i=0;i<intlist.length;i++) {
			intlist[i] = ints.get(i);
		}
		return intlist;
	}
	private static String[] readLine(){
		try{
			return reader.readLine().split(" ");
		}catch(Exception e){
			e.printStackTrace();
			return new String[]{e.getMessage()};
		}
	}
	private static int[] readLineInt(){
		try{
			String[] s = readLine();
			int[] ints = new int[s.length];
			for(int i=0;i<ints.length;i++) {
				ints[i] = Integer.parseInt(s[i]);
			}
			return ints;
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	private static byte[] readLineByte(){
		try{
			String[] s = readLine();
			byte[] bytes = new byte[s.length];
			for(int i=0;i<bytes.length;i++) {
				bytes[i] = Byte.parseByte(s[i]);
			}
			return bytes;
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	private static char[] readLineChar(){
		try{
			String[] s = readLine();
			char[] chars = new char[s.length];
			for(int i=0;i<chars.length;i++) {
				chars[i] = (char)Integer.parseInt(s[i]);
			}
			return chars;
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	private static void print(Object o){
		System.out.println(o);
	}
	private static void print(){
		System.out.println();
	}
	private static void printd(Object o){
		if(MODE_DEBUG)System.err.println(o);
	}
	private static void printd(){
		if(MODE_DEBUG)System.err.println();
	}
}


Measured memory_bytes: 32624
#include <cstdio>
#include <cstring>
using namespace std;

int main()
{
	int dp[50][3001];
	
	int N, M, S;
	while (scanf("%d %d %d", &N, &M, &S), N + M + S){
		memset(dp, 0, sizeof(dp));
		dp[0][0] = 1;
		
		for (int i = 1; i <= M; i++){
			for (int j = N * N; j >= 1; j--){
				for (int k = S; k >= i; k--){
					dp[j][k] = (dp[j][k] + dp[j - 1][k - i]) % 100000;
				}
			}
		}
		
		printf("%d\n", dp[N * N][S]);
	}
	
	return 0;
}

Measured memory_bytes: 1624
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1LL<<60;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
template<class T> void puts(T x) { std::cout << x << std::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; }
using namespace std;

int main() {
    string s; cin >> s;
    int n = s.length();
    vector<int> ans(n);
    rep(i, n) ans[i] = 0;

    int n_even = 1, n_odd = 0;
    int idx_even, idx_odd;
    for (int i = 1; i < n; i++) {
        if (s[i-1] == 'R' && s[i] == 'R') {
            if (i % 2 == 0) n_even++;
            else n_odd++;
        } else if (s[i-1] == 'L' && s[i] == 'L') {
            if (i % 2 == 0) n_even++;
            else n_odd++;
        } else if (s[i-1] == 'R' && s[i] == 'L') {
            if (i % 2 == 0) {
                n_even++;
                idx_even = i;
                idx_odd = i - 1;
            } else {
                n_odd++;
                idx_even = i - 1;
                idx_odd = i;
            }
        } else if (s[i-1] == 'L' && s[i] == 'R') {
            ans[idx_even] = n_even;
            ans[idx_odd] = n_odd;
            if (i % 2 == 0) {
                n_even = 1, n_odd = 0;
            } else {
                n_even = 0, n_odd = 1;
            }
        }
    }

    ans[idx_even] = n_even;
    ans[idx_odd] = n_odd;

    for (auto x: ans) {
        cout << x << ' ';
    }
    cout << endl;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n) for (int i=1; i < (int)(n); i++)
#define rrep(i, n) for (int i=((int)(n)-1); i>=0; i--)
#define rreps(i, n) for (int i=((int)(n)-1); i>0; i--)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
using lint = long long;
using p = pair<int, int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int n;
int main() {
  scanf("%d", &n);
  int p[30];
  rep (i, n) scanf("%d", &p[i]);
  int cnt = 0;
  reps (i, n-1) {
    int m = min(min(p[i-1], p[i]), p[i+1]);
    int M = max(max(p[i-1], p[i]), p[i+1]);
    if (m < p[i] && p[i] < M){
      cnt ++;
    }
  }
  printf("%d\n", cnt);
  return 0;
}


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

using namespace std;
typedef long long ll;

int main(int argc, const char * argv[]) {
    int N; cin >> N;
    vector<int> B(N-1);
    for (int i = 0; i < N-1; i++) cin >> B[i];
    
    int max_sum = B[0] + B[N-2];
    for (int i = 1; i < N-1; i++) {
        max_sum += min(B[i], B[i-1]);
    }
    cout << max_sum << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n], b[n], c[n];
  for ( int i = 0; i < n; i++){
    cin >> a[i];
  }
  for ( int i = 0; i < n; i++){
    cin >> b[i];
  }
  for ( int i = 1; i <= n-1; i++){
    cin >> c[i];
  }

  int ans = b[0];
  for ( int i = 1; i < n; i++){
    ans += b[i];
    if ( a[i] == a[i-1] + 1){
      ans += c[a[i-1]];
    }
  }

  cout << ans << endl;

  return 0;
}

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

int main(){
    string s;
    cin>>s;
    for (int i = 0; i < s.size(); ++i) {
        if(i%2==0){
            if(s[i]=='L'){
                cout<<"No"<<endl;
                return 0;
            }
        }
        else {
            if(s[i]=='R'){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
import Control.Monad
import Data.Char
import Data.List
main=putStrLn.solve=<<getLine
solve abcd=g abcd.head.filter(f a bcd)$replicateM 3"+-"where
  (a:bcd)=map digitToInt abcd
f s(a:as)(op:ops)=f t as ops where
  t=case op of
    '+'->s+a
    '-'->s-a
f s _ _=s==7
g a b=(++"=7").concat.transpose$a:[b]

Measured memory_bytes: 3652
from numpy.linalg import matrix_power
from numpy import dot

class mint:
    def __init__(self, n):
        self.n = n % mod

    def __add__(self, other):
        return mint(self.n + other.n)

    def __mul__(self, other):
        return mint(self.n * other.n)

    def __repr__(self):
        return str(self.n)


L, A, B, mod = map(int, input().split())

ans = [mint(0), mint(A), mint(B)]

size = 0
for d in range(1, 19):
    x = pow(10, d, mod)
    T = [
        [mint(x), mint(0), mint(0)],
        [mint(1), mint(1), mint(0)],
        [mint(0), mint(1), mint(1)],
    ]

    cnt = min(L - size, max(0, 10 ** d - 1 - A) // B - size + 1)
    if cnt > 0:
        ans = dot(ans, matrix_power(T, cnt))

    size += cnt
    if size >= L:
        break

print(ans[0])

Measured memory_bytes: 12208
n = int(input())
b = list(map(int,input().split()))
a = []
a.append(b[0])
for i in range(1,n - 1):
    a.append(min(b[i - 1],b[i]))
a.append(b[-1])
num = 0
for i in range(n):
    num += a[i]
print(num)

Measured memory_bytes: 9000
main :: IO ()
main = do
  as <- fmap (map read . words) getLine :: IO [Int]
  print . solve $ as

solve :: [Int] -> Int
solve (a:b:c:_) = abs (a - b) + abs (b - c) + abs(c - a) - abs (a - b) `max` abs (b - c) `max` abs(c - a)


Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;
    A--; B--; C--; D--;
    string S;
    cin >> S;
    
    bool ans = true;
    int cnt = 0;
    for(int i = A; i < C; i++) {
        if(S.at(i)=='#') {
            cnt++;
            if(cnt==2) {
                ans = false;
                break;
            }
        }
        else cnt = 0;
    }
    cnt = 0;
    for(int i = B; i < D; i++) {
        if(S.at(i)=='#') {
            cnt++;
            if(cnt==2) {
                ans = false;
                break;
            }
        }
        else cnt = 0;
    }
    
    if(D < C) {
        bool tmp = false;
        int cnt = 0;
        for(int i = B - 1; i <= D + 1; i++) {
            if(S.at(i)=='.') cnt++;
            else cnt = 0;
            
            if(cnt==3) {
                tmp = true;
                break;
            }
        }
        
        if(!tmp) ans = false;
    }
    
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 640
#include<stdio.h>

#define MAX 500000
#define SENTINEL 2000000000

int L[MAX/2+2],R[MAX/2+2];
//int cnt=0;  cnt=nlogn

void merge(int A[],int n,int left,int mid,int right){ //分割と統治
    int n1 = mid-left;
    int n2 = right-mid;
    for(int i=0;i<n1;i++) L[i]=A[left+i];
    for(int i=0;i<n2;i++) R[i]=A[mid+i];
    L[n1]=R[n2]=SENTINEL;  //番兵
    int i=0,j=0;
    for(int k=left;k<right;k++){
        //cnt++;
        if(L[i]<=R[j]){
            A[k]=L[i++];
        }else{
            A[k]=R[j++];
        }
    }
}

void mergeSort(int A[],int n,int left,int right){
    if(left+1<right){  //要素数が2つ以上
        int mid = (left+right)/2;
        mergeSort(A,n,left,mid);
        mergeSort(A,n,mid,right);
        merge(A,n,left,mid,right);
    }
}

int main(void){
    int n,i;
    scanf("%d",&n);
    int x[n],b[n];
    for(i=0;i<n;i++){
        scanf("%d",&x[i]);
        b[i] = x[i];
    }
    
    mergeSort(b,n,0,n);
    
    for(i=0;i<n;i++){
        if(x[i]<b[n/2]){
            printf("%d\n",b[n/2]);
        }else{
            printf("%d\n",b[(n/2)-1]);
        }
    }
    return 0;
}


Measured memory_bytes: 4480
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
int p[30];
int main(){
	cin>>N;
	REP(i,N){
		cin>>p[i];
	}
	int ans=0;
	REP(i,N-2){
		if(p[i+1]>p[i]&&p[i+1]<p[i+2]){
			ans++;
		}
		if(p[i+1]<p[i]&&p[i+1]>p[i+2]){
			ans++;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S = sc.next();
		char[] C = S.toCharArray();
		int count = 1;
		for(int i=0; i<N-1; i++) {
			if(C[i]!=C[i+1]) {
				count++;
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 25812
n, k = map(int, input().split())
A = [int(i) for i in input().split()]

def gcd(x, y):
    while y > 0:
        x, y = y, x % y
    return x

B = [0] * (n - 1)
for i in range(n - 1):
    B[i] = gcd(A[i], A[i + 1])
    
if k > max(A):
    print('IMPOSSIBLE')
elif k in A:
    print('POSSIBLE')
elif k % B[-1] == 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Measured memory_bytes: 14224
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        int a,b,c;
        Scanner input = new Scanner(System.in);
        a = input.nextInt();
        b = input.nextInt();
        c = input.nextInt();
        if(a<b&&b<c)
        {
         System.out.println("Yes");
        }
        else
            System.out.println("No");
        
    }
    
}

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

#define ll long long
#define ld long double
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define int long long

using namespace std;
const int INF = 2e18;
const int MOD = 1e9 + 7;
const int MB = 20;
const int maxN = 4e6 + 1;

int fact[maxN], rev[maxN];

int mod_pow(int a, int b) {
	if (!b) return 1;
	if (b % 2) return a * mod_pow(a, b - 1) % MOD;
	int q = mod_pow(a, b / 2);
	return q * q % MOD;
}

int C(int n, int k) {
	return (fact[n] * rev[k] % MOD) * rev[n - k] % MOD;
}

int f(int r, int c) {
	int ans = (C(r + 1 + c + 1, c + 1) - 1 + MOD) % MOD;

	return ans;
}

void solve() {
	fact[0] = 1;
	for (int i = 1; i < maxN; i++) fact[i] = fact[i - 1] * i  % MOD;
	for (int i = 0; i < maxN; i++) rev[i] = mod_pow(fact[i], MOD - 2);
	int r1, c1, r2, c2;
	cin >> r1 >> c1 >> r2 >> c2;
	cout << (f(r2, c2) - f(r2, c1 - 1) - f(r1 - 1, c2) + f(r1 - 1, c1 - 1) + 5 * MOD) % MOD;
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout << fixed;
	cout.precision(12);
	solve();
}


Measured memory_bytes: 62848
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


int H,W;
string S[1010];
int D[1010][1010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>H>>W;
	queue<int> Q;
	FOR(y,H) {
		cin>>S[y];
		FOR(x,W) {
			if(S[y][x]=='#') {
				D[y][x]=0;
				Q.push(y*1000+x);
			}
			else {
				D[y][x]=0;
			}
		}
	}
	
	int ma=0;
	while(Q.size()) {
		int cy=Q.front()/1000;
		int cx=Q.front()%1000;
		ma=max(ma,D[cy][cx]);
		Q.pop();
		FOR(i,4) {
			int dd[4]={0,1,0,-1};
			int ty=cy+dd[i];
			int tx=cx+dd[i^1];
			if(ty<0 || ty>=H || tx<0 || tx>=W) continue;
			if(S[ty][tx]=='#') continue;
			S[ty][tx]='#';
			D[ty][tx]=D[cy][cx]+1;
			Q.push(ty*1000+tx);
		}
		
		
	}
	
	
	cout<<ma<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 9344
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl '\n'

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

  //  ll t; cin>>t; while(t--)
    {
     string s,t;
     cin>>s>>t;
     t.pop_back();
     if(s==t)
     cout<<"Yes\n";
     else
     cout<<"No\n";

    }

  


    return 0;
}

Measured memory_bytes: 3652
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        abc157_a solver = new abc157_a();
        solver.solve(1, in, out);
        out.close();
    }

    static class abc157_a {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();

            if (Math.floorMod(N, 2) != 0) {
                out.println(((int) (N / 2)) + 1);

            } else {
                out.println((int) (N / 2));
            }
        }

    }
}



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

int main() {
  string S,T,U;
  cin >> S >> T >> U;
    
  if(S.at(S.size() - 1) == T.at(0) && T.at(T.size() - 1) == U.at(0)){
    cout << "YES" << endl;
  }
  
  else{
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <cstdio>
using namespace std;

int main()
{
    int N;
    double L;
    cin>>N>>L;
    vector<double> T(N);
    for (double &t: T)
        cin>>t;

    double pi = acos(-1.0);

    double ax = 0.0;
    double ay = 0.0;

    double n = (double)N*(N-1)*(N-2)/6;
    for (int i=0; i<N; i++)
    for (int j=i+1; j<N; j++)
    {
        double t = (T[j]+T[i])/2/L*(2*pi);
        ax += (N-(j-i)-1)*cos(t)/n;
        ay += (N-(j-i)-1)*sin(t)/n;
        ax += (j-i-1)*cos(t+pi)/n;
        ay += (j-i-1)*sin(t+pi)/n;
    }
    printf("%.10f %.10f\n", ax, ay);
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int mod=1e9+7;
long long a[100010];
int main()
{
	int n;
	long long x=1,y=1,z=1;
	scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
    	x*=10;x%=mod;
    	y*=9;y%=mod;
    	z*=8;z%=mod;
	}
	long long ans=((x-2*y)%mod+z+mod)%mod;
	printf("%lld\n",ans);
}

Measured memory_bytes: 3784
//#define DEB1 //input from input.txt
//#define NDEBUG
#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <thread>
#include <mutex>
#include <iomanip>
#include <cassert>

#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define INF(a) memset(a, 0x3f, sizeof(a))
#define ALL(t) (t).begin(),(t).end()
#define FILL(a,c) fill(a, a+ sizeof(a)/sizeof(*a),c)
#define FILL2D(A,c) fill(A[0], A[0] +sizeof(A)/sizeof(**A),c)
#define FILL3D(A,c) fill(A[0][0], A[0][0] +sizeof(A)/sizeof(***A),c)
#define REP(i,m) for(int i=0;i<(m);++i)
// closed interval, inverse repeat
#define CIREP(i,start,fin) for(int i=(start);i>=(fin);i--)
#define CREP(i,start,fin) for(int i=(start);i<=(fin);i++)
#define RNG(i,start,fin) for(int i=(start);i<(fin);i++)
#define IN(a, x, b) (a<=x && x<b)
#define PB push_back
#define SZ(x) (int)(x).size()

using namespace std;

using LL = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<LL,LL>;
using VI = vector<int>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VVI = vector<VI>;
const LL LINF = 1001002003004005006ll;
/* 
template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,SZ(v))i>>v[j];return i;}

template<typename T>string join(const vector<T>&v)
{stringstream s;REP(i,SZ(v))s<<' '<<v[i];return s.str().substr(1);}

template<typename T>inline ostream& operator<<(ostream&o,const vector<T>&v)
{if(SZ(v))o<<join(v);return o;}
*/

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




/*
constant values
*/

//const int dx[] = {1,0,-1,0};
//const int dy[] = {0,1,0,-1};
//const int MX = 31001;

//const ll INF= 1LL<<60 ;//INF = 1001001001001; //1e9


// Main program
void solve(){
    int n,k,s;
    cin >> n >> k >> s;
    int INF = 1000000000;//10e9
    if(s==INF){
        REP(i,k){
            cout << s << endl;
        }
        REP(i,n-k){
            cout << INF - 1 << endl;
        }
    }else{
        REP(i,k){
            cout << s << endl;
        }
        REP(i,n-k){
            cout << INF << endl;
        }
    }

    return;
}



// ----------------------------------------------
int main(){

#ifdef DEB1
    cout << "DEBUG MODE"  << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf()); //for debug
#endif

    int T=1; 

    for (int i = 0; i < T; ++i) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 1280
//Bismillah hirrahmanir Rahim
        #include<bits/stdc++.h>
        #define ll long long
        #define pb push_back
        #define dbug printf("I am here\n");
        #define Fast ios_base::sync_with_stdio(false); cin.tie(0);
        const int m = 10e6;
        using namespace std;

        int main(){
         long long int a,b,tst,n,k;
        cin>>n;
        if(n==1){
            cout<<0<<" "<<"-1"<<endl;
            return 0;
        }
       for(int i=-200;i<=200;i++){
        for(int j=-200;j<=200;j++){

             if((i*i*i*i*i) - ( j*j*j*j*j )== n){
                cout<<i<<" "<<j<<endl;
                return 0;
            }
        }

       }

           return 0;

        }


Measured memory_bytes: 3604
#include<iostream>
using namespace std;
int main()
{
    string s;
    cin >> s;
    
    string result = "No";
    if (s[0] == s[1] && s[0] != s[2] && s[2] == s[3]) {
      result = "Yes";
    } else if (s[0] == s[2] && s[0] != s[1] && s[1] == s[3]) {
      result = "Yes";
    } else if (s[0] == s[3] && s[0] != s[1] && s[1] == s[2]) {
      result = "Yes";
    }
    cout << result <<endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static PrintWriter out;

    public static void main(String[] args) throws IOException {
        out = new PrintWriter(new OutputStreamWriter(System.out));
        CF_Reader in = new CF_Reader();

        int n = in.intNext(), k = in.intNext();
        long[] nums = new long[(int) n];
        for (int i = 0; i < n; i++) nums[i] = in.longNext();

        double[] maxAdjacent = getMaxAdjacentNums(nums, k);
        double res = 0;
        for (double nm: maxAdjacent) res += (1 + nm) / 2;
        out.println(res);

        out.close();
    }

    static double[] getMaxAdjacentNums(long[] nums, int k) {
        int endIdx = 0;
        long total = 0;
        long best = 0;

        for (int i = 0; i < nums.length; i++) {
            if (i < k) total += nums[i];
            else {
                total += nums[i];
                total -= nums[i - k];
            }
            if (i >= k - 1 && total > best) {
                best = total;
                endIdx = i;
            }
        }
        double[] res = new double[k];
        int start = endIdx - k + 1;
        for (int i = start; i <= endIdx; i++) res[i - start] = nums[i];
        return res;
    }

    static class CF_Reader {
        BufferedReader br;
        StringTokenizer st;

        public CF_Reader() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine().trim());
            return st.nextToken();
        }

        long longNext() throws IOException {
            return Long.parseLong(next());
        }

        int intNext() throws IOException {
            return Integer.parseInt(next());
        }

        double doubleNext() throws IOException {
            return Double.parseDouble(next());
        }

        char charNext() throws IOException {
            return next().charAt(0);
        }

        public int[] nextIntArray(final int n) throws IOException {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = intNext();
            return a;
        }

        public long[] nextLongArray(final int n) throws IOException {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = longNext();
            return a;
        }

        String line() throws IOException {
            return br.readLine().trim();
        }
    }
}


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

int main(){
    ll n, m; cin >> n >> m;
    vector<int> lis(n+1, 0), lis2(n+1, 0);
    for(int i = 0; i < m; i++){
        int a, b; cin >> a >> b;
        if(a == 1){
            lis[b] = 1;
        }
        if(b == n){
            lis2[a] = 1;
        }
    }
    for(int i = 2; i < n; i++){
        if(lis[i] == 1 && lis2[i] == 1){
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}

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

int main(){
  string S;
  cin>>S;
  int N=S.size();
  int cnt=0;
  int64_t sum=0;
  while(cnt<N){
    if(S[cnt]=='>'){
      int64_t a=0;
      while(cnt<N && S[cnt]=='>'){
        ++cnt;
        ++a;
      }
      sum += a*(a+1)/2;
    }
    else if(S[cnt]=='<'){
      int64_t a=0,b=0;
      while(cnt<N && S[cnt]=='<'){
        ++cnt;
        ++a;
      }
      while(cnt<N && S[cnt]=='>'){
        ++cnt;
        ++b;
      }
      sum += max(a,b);
      sum += a*(a-1)/2;
      sum += b*(b-1)/2;
    }
  }
  cout<<sum<<endl;

}

Measured memory_bytes: 900
#include <cstdio>
#include <cassert>
#include <algorithm>    
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <bitset>
#define pb push_back
#define mk make_pair
#define eb emplace_back
#define eps 1e-8
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define int long long


using namespace std;
typedef long double ld;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef tuple<int, int, int> tiii;
typedef vector<int> vii;
typedef vector<long double> vd;
const int inf = 1e9;
const long long INF = 1e18;
const int M = 1e9 + 7;





signed main()
{
#ifndef ONLINE_JUDGE
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
#endif
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(n * a, b) << endl;





    
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
  static void Main(string[] args)
  {
    var inputLine = int.Parse(Console.ReadLine());
    var numbers = new List<int>();
    for(int i = 0;i < inputLine; i++)
    {
      numbers.Add(int.Parse(Console.ReadLine()));
    }
    var steps = numbers.OrderBy(x => x).Distinct().Count();
    Console.WriteLine(steps);
  }
}

Measured memory_bytes: 13280
#include<stdio.h>
 int main(void){
 int a,b,c; 
int count=0;
 int i;
 scanf("%d %d %d",&a,&b,&c);

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

return 0;
 }

Measured memory_bytes: 596
#include <stdio.h>

int main(){
  int n,i;
  long long A[251];

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%lld",&A[i]);
  }

  for(i=1;i<=n;i++){
    printf("node %d: key = %lld, ",i,A[i]);
    if(i/2>0) printf("parent key = %lld, ",A[i/2]);
    if(2*i+1>0 && 2*i<=n) printf("left key = %lld, ",A[2*i]);
    if(2*i+1>0 && 2*i+1<=n) printf("right key = %lld, ",A[2*i+1]);
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 600
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}

double need(double base, double k){
  double cnt = 0;
  while (base < k){
    base *= 2; ++cnt;
  }
  return cnt;
}

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

  double n, k; cin >> n >> k;
  double ans = 0;
  double each = 1.0 / n;

  for (int i = 1; i <= n; ++i){
    ans += each * pow(0.5, need(i, k));
  }

  cout << setprecision(20) << ans << '\n';

  return 0;
}

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

using namespace std;

const int mxn = 1e5;
bool flag[mxn + 11];
int a[mxn + 11];

void sieve() {
    memset(flag, true, sizeof(flag));
    flag[1] = false;
    for (int i = 4; i <= mxn; i += 2) flag[i] = false;
    for (int i = 3; i <= mxn; i += 2) {
        if (flag[i]) {
            for (int j = i + i; j <= mxn; j += i)
                    flag[j] = false;
        }
    }
    for (int i = 3; i <= mxn  - 1; i += 2) {
        int x = (i + 1) / 2;
        if (flag[x] && flag[i]) {
            a[i]++;
        }
        a[i] += a[i - 2];
    }
    return;
}

int main() {
    sieve();
    int q;
    scanf("%d", &q);
    while (q--) {
        int l, r;
        scanf("%d %d", &l, &r);
        printf("%d\n", a[r] - a[l - 2]);
    }
    return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;

// @@ !! LIM()


string func(ll x) {
  if (x == 0) return "";
  if (x % 2 == 0) {
    return func(- x / 2) + "0";
  }else {
    return func(- (x - 1) / 2) + "1";
  }
}


int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);
  ll N; cin >> N;
  string ans = func(N);
  cout << (ans == "" ? "0" : ans) << endl;
  

  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define A first
#define B second
#define make_pair MP
#define MOD 1000000007
#define MAXM 100005
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef long long ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int mulmd(ll a, ll b){
    ll ret = (a * b) % MOD;
    return (int)ret;

}

inline int power(ll x, ll y, int p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = mulmd(res,x);
        y = y>>1;
        x = mulmd(x,x);
    }
    return (int)res;
}

int submd(ll a, ll b){
    ll ret = a-b;
    if(ret<0){
        ret+=MOD;
    }
    return (int)ret;
}

int addmd(ll a, ll b){
    ll ret = (a + b) % MOD;
    return (int)ret;
}

int phi(int n){
    int result = n;
    for(int i=2;i*i<=n;i++){
        if(n%i==0){
            while(n%i==0){
                n=n/i;
            }
            result-=result/i;
        }
    }
    if(n>1) result-=result/n;
    return result;
}

int gcd(int a, int b, int& x, int& y){
    if(a==0){
        x=0;
        y=1;
        return b;
    }
    int x1,y1;
    int d = gcd(b%a, a, x1, y1);
    x = y1 - (b/a)*x1;
    y = x1;
    return d;
}

int arr[100005];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b;
    cin>>a>>b;
    int so=1;int ans=0;
    while(1)
    {
        if(so>=b)
            break;
        else
        {
            so-=1;
            so+=a;
            ans++;
        }
    }
    cout<<ans;
}



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

int main(){
  int n; cin >> n;
  int a[n], b[n-1]; 
  for(int i=0; i<n-1; i++) cin >> b[i];
  
  a[n-1] = b[n-2]; a[0] = b[0];
  for(int i=1; i<n-1; i++){
    a[i] = min(b[i-1], b[i]);
  }

  int ans = 0;
  for(int i=0; i<n; i++) ans += a[i];
  cout << ans << endl;
}


Measured memory_bytes: 256