akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;
vector<pair<int, int>> fVec, tVec;
vector<int> dirVec[2];
int e[5], memo[8001][16004], result[5];
char s[8005];

void func(int dir, int tidx, int hap, int fidx)
{
    if(result[dir] == 1)
    {
        return;
    }
    if(tidx == dirVec[dir].size())
    {
        if(hap == e[dir])
        {
            result[dir] = 1;
        }
        return;
    }
    int &ret = memo[tidx][hap + 8001];
    if(ret != 0)
    {
        return;
    }
    ret = 1;
    int nextHap = 0;
    for(int i = fidx; i < fVec.size(); i++)
    {
        if(fVec[i].first > dirVec[dir][tidx])
        {
            nextHap = fVec[i].second;
            fidx = i;
            break;
        }
    }
    func(dir, tidx + 1, hap + nextHap, fidx + 1); 
    func(dir, tidx + 1, hap - nextHap, fidx + 1);
    return;
}

int main()
{
    int length;
    scanf("%s %d %d", s, &e[0], &e[1]);
    length = strlen(s);
    int count = 1;
    for(int i = 0; i < length; i++)
    {
        if(s[i] != s[i + 1])
        {
            if(s[i] == 'T')
            {
                tVec.push_back({i, count});
            }
            else
            {
                fVec.push_back({i, count});
            }
            count = 0;
        }
        count++;
    }
    if(tVec.size() == 0)
    {
        if(e[1] == 0 && fVec[0].second == e[0])
        {
            printf("Yes");
        }
        else
        {
            printf("No");
        }
        return 0;
    }
    if(fVec.size() == 0)
    {
        if(e[0] == 0 && e[1] == 0)
        {
            printf("Yes");
        }
        else
        {
            printf("No");
        }
        return 0;
    }
    int flag = 0;
    for(int i = 0; i < tVec.size(); i++)
    {
        if(tVec[i].second % 2 != 0)
        {
            flag = !flag;
        }
        dirVec[flag].push_back(tVec[i].first);
    }
    int startHap = 0, startF = 0;
    if(fVec[0].first < tVec[0].first)
    {
        startHap = fVec[0].second;
        startF = 1;
    }
    func(0, 0, startHap, startF);
    memset(memo, 0, sizeof memo);
    func(1, 0, 0, 0);
    result[0] + result[1] == 2 ? printf("Yes") : printf("No");
}

Measured memory_bytes: 500736
#include<stdio.h>
int a[4]={0};
int b[4]={0};
int hit=0,blow=0;

int main()
{
    while(scanf("%d",&a[0])!=-1)
    {
        for(int i=1;i<4;i++)
        {
            scanf("%d",&a[i]);
        }
        for(int i=0;i<4;i++)
        {
            scanf("%d",&b[i]);
        }
        for(int i=0;i<4;i++)
        {
            if(a[i]==b[i])
            {
                hit++;
                a[i]=10;
                b[i]=10;
            }
        }
        for(int i=0;i<4;i++)
        {
            if(b[i]!=10)
            {
                for(int j=0;j<4;j++)
                {
                    if(b[i]==a[j])
                    {
                        blow++;
                    }
                }
            }
        }
        printf("%d %d\n",hit,blow);
        for(int i=0;i<4;i++)
        {
            a[i]=0;
            b[i]=0;
        }
        hit=0;
        blow=0;
    }
    return 0;
}

Measured memory_bytes: 1028
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define pii pair<int, int>
#define pll pair<long long, long long>
const double PI = acos(-1);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    while (1) {
        int N; cin >> N;
        if (N==0) break;
        vector<int> A(N);
        rep(i,N-1) A[i+1] = A[i]+i+1;
        int cnt = 0;
        rep(i,N-1) {
            for (int j = i+1; j < N; j++) {
                if (A[j]-A[i]==N) cnt++;
            }
        }

        cout << cnt << endl;
    }
}


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

template <class T> class UnionFind {

  private:
    struct subset  {
      T parent;
      T rank;
      T diff_weight;
      T sizes;
    };
    std::vector<subset> subsets;

  public:
    UnionFind (T N) {
      subsets.reserve(N);
      for(T i=0; i<N; i++){
        subsets.push_back( { i, 0, 0, 1 } );
      }
    }

    T Find (T x) {
      if (subsets[x].parent == x) return x;
      subsets[x].diff_weight += subsets[subsets[x].parent].diff_weight;
      return subsets[x].parent = Find(subsets[x].parent);
    }

    T weight(T x) {
      Find(x);
      return subsets[x].diff_weight;
    }

    bool Same (T x, T y) {
        return Find(x) == Find(y);
    }

    bool Union (T x, T y, T w) {
      w += weight(x); w -= weight(y);

      T xroot = Find(x);
      T yroot = Find(y);
      if ( xroot == yroot ) return false;

      if (subsets[xroot].rank < subsets[yroot].rank) {
        subsets[xroot].parent = yroot;
        w = -w;
        subsets[yroot].sizes += subsets[xroot].sizes;
      }
      else if (subsets[xroot].rank > subsets[yroot].rank) {
        subsets[yroot].parent = xroot;
        subsets[xroot].sizes += subsets[yroot].sizes;
      }
      else {
        subsets[yroot].parent = xroot;
        subsets[xroot].rank++;
        subsets[xroot].sizes += subsets[yroot].sizes;
      }
      subsets[yroot].diff_weight = w;
      return true;
    }

    T diff(T x, T y) {
      return weight(y) - weight(x);
    }

    T size (T x) {
      return subsets[Find(x)].sizes;
    }
};


int main (void) {

  int N, M;
  std::cin >> N >> M;

  std::vector<std::pair<int,int>> p(M);
  for(int i=0; i<M; i++){
    int a,b; std::cin >> a >> b;
    p[i].first  = a-1;
    p[i].second = b-1;
  }

  int ans = 0;
  for(int i=0; i<M; i++){
    UnionFind<int> uf(N);
    for(int j=0; j<M; j++){
      if ( i==j ) continue;
      uf.Union(p[j].first, p[j].second, 0);
    }
    if ( !uf.Same(p[i].first, p[i].second) ) ans++;
  }
  std::cout << ans << std::endl;

  return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using CompLib.Util;
using System.Threading;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        Console.WriteLine(1-sc.NextInt());
    }

    public static void Main(string[] args) => new Program().Solve();
    // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 27340
#include <vector>
#include <algorithm>

using namespace std;

void scc_dfs(int at, int &cnt, vector<int> &inum, vector<bool> &used, const vector<vector<int>> &graph)
{
    used[at] = true;
    for (int ne : graph[at]) {
        if (!used[ne]) scc_dfs(ne, cnt, inum, used, graph);
    }
    inum[cnt] = at;
    cnt++;
}

#include <iostream>
void scc_rdfs(int at, vector<int> &cs, vector<bool> &used, const vector<vector<int>> &inv)
{
    used[at] = true;
    cs.push_back(at);
    for (int ne : inv[at]) {
        if (!used[ne]) scc_rdfs(ne, cs, used, inv);
    }
}


vector<vector<int>> strongly_connected_components(const vector<vector<int>> &graph)
{
    const int V = graph.size();

    int cnt = 0;
    vector<int> inum(V);
    vector<bool> used(V);
    for (int i = 0; i < V; i++) {
        if (!used[i]) scc_dfs(i, cnt, inum, used, graph);
    }

    vector<vector<int>> inv(V);
    for (int i = 0; i < V; i++){
        for (int v : graph[i]) {
            inv[v].push_back(i);
        }
    }
    fill(used.begin(), used.end(), false);
    vector<vector<int>> ret;
    for (int i = V - 1; i >= 0; i--) {
        vector<int> cs;
        if (!used[inum[i]]) scc_rdfs(inum[i], cs, used, inv);
        ret.push_back(cs);
    }
    return ret;
}

#include <iostream>

int main()
{
    ios::sync_with_stdio(false);

    int V, E;
    cin >> V >> E;
    vector<vector<int>> graph(V);
    int s, t;
    for (int i = 0; i < E; i++) {
        cin >> s >> t;
        graph[s].push_back(t);
    }

    auto res = strongly_connected_components(graph);
    vector<int> num(V);
    for (int i = 0; i < res.size(); i++) {
        for (int v : res[i]) {
            num[v] = i;
        }
    }

    int Q;
    cin >> Q;
    int u, v;
    for (int i = 0; i < Q; i++) {
        cin >> u >> v;
        cout << (num[u] == num[v]) << endl;
    }
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll MOD = 1000000007;

int main(){
  string S;
  cin >> S;
  int N=S.size(),count=0;
  for(int i=N-1;i>=0;i--){
    if(S[i]=='B'){
      count ++;
    }
    if(S[i]!='B' && count>0){
      count --;
      S[i] = '#';
    }
  }
  for(int i=0;i<N;i++){
    if(S[i]=='0'||S[i]=='1'){
      cout << S[i];
    }
  }
  cout << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------

int N;
string S;

int main() {
  cin >> N;
  cin >> S;

  for (auto c : S) {
    char nc = c + N;
    if (nc > 'Z') nc -= 26;
    cout << nc;
  }
}


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


def count_digit(n: int) -> int:
    digit = 0

    while n:
        digit += 1
        n //= 10

    return digit


def main():
    n = int(input())
    ans = 0

    for i in range(1, n + 1):
        if count_digit(i) % 2 == 1:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
 
public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        double r = Double.parseDouble(line);
        System.out.println(String.format("%.6f %.6f", r*r*Math.PI, 2*r*Math.PI));
    }
}

Measured memory_bytes: 24696
let [| N; X; Y |] = stdin.ReadLine().Split() |> Array.map int

let result = Array.zeroCreate<int> N

let rec solver i j =
    if i = N then ()
    elif j = N + 1 then solver (i + 1) (i + 2)
    else
        let d1 = j - i
        let d2 = abs (X - i) + abs (Y - j) + 1
        let d = min d1 d2
        result.[d] <- result.[d] + 1
        solver i (j + 1)

solver 1 2

for i in [ 1..N - 1 ] do
    result.[i] |> stdout.WriteLine


Measured memory_bytes: 11348
import collections

N = int(input())
judge = []

for i in range(N):
  j = input()
  judge.append(j)

#print(judge)

count = collections.Counter(judge)

#print(count)

print('AC x', str(count['AC']))
print('WA x', str(count['WA']))
print('TLE x', str(count['TLE']))
print('RE x', str(count['RE']))

Measured memory_bytes: 16652
#include <bits/stdc++.h>
using namespace std;
const int N = 3005, MOD = 1e9 + 7;
int f[N][N][2];
void upd(int &x, int y) { (x += y) %= MOD; }
int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 0; i <= n; ++ i) f[0][i][i == 0] = 1;
	for (int i = 1; i <= m; ++ i) {
		for (int j = 0; j <= n; ++ j) {
			for (int k = 0; k <= 1; ++ k) {
				int g = f[i - 1][j][k];
				if (j > 0) upd(f[i][j - 1][k | (j == 1)], g);
				if (j > 0) upd(f[i][j][k | (j == 1)], g);
				if (j < n) upd(f[i][j][k], g);
				if (j < n) upd(f[i][j + 1][k], g);
			}
		}
	}
	int ans = 0;
	for (int i = 0; i <= n; ++ i) upd(ans, f[m][i][1]);
	printf("%d\n", ans);
}


Measured memory_bytes: 70656
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N,X = I()
m = [i() for _ in range(N)]
X -= sum(m)
print(N+X//min(m))

Measured memory_bytes: 10020
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	if(b<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
// ここから編集しろ
char in[110000];

int main(){
	scanf("%s",in);
	int n=strlen(in);
	int A=0;
	int B=0;
	for(int i=0;i<n;i++){
		if(in[i]=='0')A++;else B++;
	}
	printf("%d\n",min(A,B)*2);
}

Measured memory_bytes: 256
#include <stdio.h>
 
using namespace std;
 
int main(){
    int a,b;
    while(true){
        scanf("%d %d",&a,&b);
        if(a == 0 && b == 0) break;
        if(a > b) printf("%d %d\n",b,a);
        else{
            printf("%d %d\n",a,b);
        }
    }
}


Measured memory_bytes: 2692
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>
#include <list>
#include <random>

// macros
#define ll long long int
#define pb emplace_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

// solve
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(a > b){a = b; return 1;} return 0;}


int main(int argc, char const* argv[])
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  set<string> st;
  rep(i, n){
    string a, b;
    cin >> a >> b;
    if(a == "insert")st.insert(b);
    else{
      if(st.find(b) != st.end())cout << "yes" << endl;
      else cout << "no" << endl;
    }
  }
	return 0;
}



Measured memory_bytes: 28932
use proconio::input;

fn main() {
    input!(a: usize, b: usize, c: usize, d: usize, e: usize, f: usize);
    let mut water = vec![false; f + 1];
    let mut solt = vec![false; f + 1];
    water[0] = true;
    for &x in [100 * a, 100 * b].iter() {
        if x <= f {
            for i in 0..=f - x {
                water[i + x] |= water[i];
            }
        }
    }
    solt[0] = true;
    for &x in [c, d].iter() {
        if x <= f {
            for i in 0..=f - x {
                solt[i + x] |= solt[i];
            }
        }
    }
    let mut ans_water = 1;
    let mut ans_solt = 0;
    for i in (0..=f).filter(|&i| water[i]) {
        for j in (0..=f - i).filter(|&j| solt[j]) {
            if !(i == 0 && j == 0) && j * 100 <= i * e && ans_solt * i <= ans_water * j {
                ans_water = i;
                ans_solt = j;
            }
        }
    }
    println!("{} {}", ans_water + ans_solt, ans_solt);
}


Measured memory_bytes: 2160
#define _USE_MATH_DEFINES

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

using namespace std;

typedef pair<long long int, long long int> P;

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

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> v[20];
    for(int loop = 0; loop < M; loop++){
        int k;
        cin >> k;
        for(int i = 0; i < k; i++){
            int s;
            cin >> s;
            v[loop].push_back(s - 1);
        }
    }
    int p[20];
    for(int i = 0; i < M; i++){
        cin >> p[i];
    }
    int ans = 0;
    for(int i = 0; i < (1 << N); i++){
        int hoge = 0;
        for(int j = 0; j < M; j++){
            int cnt = 0;
            for(int num : v[j]){
                if(i & (1 << num)){
                    cnt += 1;
                }
            }
            if(cnt % 2 == p[j]){
                hoge += 1;
            }
        }
        if(hoge == M){
            ans += 1;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void)
{
	int i,n,m;
	char a[10],x[10];
	scanf("%s",a);
	n=strlen(a);
	m=0;
	for(i=0;i<n;i++){
		if(a[i]=='0'){
			x[m]=a[i];
			m++;
			
		}
		if(a[i]=='1'){
			x[m]=a[i];
			m++;
		}
		if(a[i]=='B' && m>0){
			m--;
		}
	}
	for(i=0;i<m;i++){
		printf("%c",x[i]);
	}
	printf("\n");
	return 0;
}

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

void solve(long long x, long long y){
  if ( x > 0 && y == 0 ) {
    printf("%lld\n", abs(x-y) + 1);
    return;
  } else if ( x < 0 && y == 0 ) {
    printf("%lld\n", abs(x-y));
    return;
  }

  if ( x == y ) {
    printf("0\n");
  } else if ( x >= 0 && y >= 0 && y >= x ) {
    printf("%lld\n", abs(x-y));
  } else if ( x >= 0 && y >= 0 && y < x ) {
    printf("%lld\n", abs(x-y) + 2);
  } else if ( x >= 0 && y < 0 ) {
    y = y * -1;
    printf("%lld\n", abs(y-x) + 1);
  } else if ( x < 0 && y < 0 && y > x ) {
    printf("%lld\n", abs(x-y));
  } else if ( x < 0 && y >= 0 ) {
    printf("%lld\n", abs(abs(x) - abs(y)) + 1);
  } else {
    printf("%lld\n", abs(x-y) + 2);
  }
}

int main(){	
	long long x;
	long long y;
	scanf("%lld",&x);
	scanf("%lld",&y);
	solve(x, y);
	return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  vector<ll>a ;
  rep(i,3){
    ll inp; cin  >> inp;
    a.pb(inp);
  }
  sort(all(a));
  if(a[0]==5 && a[1]==5 && a[2]==7) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


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

#include <iostream>


#define MOD 1000000007

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<ull,ull> PUll;
typedef pair<int,int> Pii;
#define GCD(a,b) __gcd(a,b)
#define LCM(a,b) (a*b)/__gcd(a,b)

auto f=[]()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
};

int main()
{
	f();
	int n;cin>>n;
	int i=0;
	int first=0;
	int second=0;
	int third=0;
	int ans=0;
	while(i<n)
	{
		if(i==0)
			cin>>first;
		else if(i==1)
			cin>>second;
		else
		{
			cin>>third;
			
			if((second>=first && second<=third) || (second>=third && second<=first))
				ans++;
			
			first=second;
			second=third;
		}
		i++;
		
	}
	
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(),(a).end()
#define N_MAX 1000
#define ll long long int
using namespace std;

int main() {
	ll H, N; cin >> H >> N;
	vector<ll> A(N);
	ll sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		sum += A[i];
	}

	if (H - sum > 0)cout << "No" << endl;
	else cout << "Yes" << endl;
}

Measured memory_bytes: 1024
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;
 
public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		long A = sc.nextLong()-1;
		long B = sc.nextLong();
		long C = sc.nextLong();
		long D = sc.nextLong();
		long CD = C*D;
		long tempC = Math.max(C,D),tempD = Math.min(C,D);
		long r = tempC%tempD;
		while(r != 0) {
			tempC = tempD;
			tempD = r;
			r = tempC%tempD;
		}
		CD /= tempD;
		long t1 = B/C - (A/C);
		long t2 = B/D - (A/D);
		long t3 = B/CD - (A/CD);	
		System.out.println(B-A-t1-t2+t3);
	}
}
 
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
 
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
 
    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }
 
    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
 
    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }
 
    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
 
    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
 
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }
 
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

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

int main() {
    int N;
    cin>>N;
    int X=-1;
    for(int i=0;i<60000;++i){
        if(i*108/100==N){
            X=i;
            break;
        }
    }
    if(X==-1)cout<<":("<<endl;
    else cout<<X<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
using namespace std;


int main() {
	string S;

	cin >> S;
	bool en = true;

	for(int i=0; i<S.size(); i++) {
		int cnt = count(S.cbegin(), S.cend(), S[i]);
		if(cnt != 2) {
			en = false;
			break;
		}
	}

	if (en) cout << "Yes";
	else    cout << "No";


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c;
  cin >> a >> b;
  c=a*b;
  if ((a*b)%2==0){
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}

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

using namespace std;

const int INF = 1e9;

int n;
char s[300005];

int main(){
	scanf("%d", &n);
	scanf("%s", s);
	
	int e = 0;
	int w = 0;
	int res = INF;
	
	for(int i = 0; i < n; i++)
	e += (s[i] == 'E');
	
	for(int i = 0; i < n; i++){
		e -= (s[i] == 'E');
		res = min(res, w + e);
		w += (s[i] == 'W');
	}
	
	printf("%d\n", res);
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <ctime>

#define inf 0x3f3f3f3f
#define Inf 0x3FFFFFFFFFFFFFFFLL
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define Rep(i, n) for (int i = 1; i <= (n); ++i)
#define clr(x, a) memset(x, (a), sizeof x)
using namespace std;
typedef long long ll;
int a[10101];
int main() {
  int n, m; cin >> n >> m;
  rep(i, n) cin >> a[i];
  int s = 0; rep(i, n) s += a[i];
  int t =0;
  rep(i, n) {
    if (a[i] * 4 * m >= s) ++t;
  }
  if (t >= m) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}



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

using ll = long long;
#define REP(i,n) for(int i = 0;i < n;i++)

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()

#define debug(arr) cout << #arr << " = " << arr << '\n'
#define debug2(a,b) cout << "[" << #a << "," << #b << "] = " << "[" << a << "," << b << "]" << '\n'
template<class T> ostream &operator << (ostream& out, const vector<T>& arr) {
	cout << "{";
	for (int i = 0; i < arr.size(); i++)cout << (!i ? "" : ", ") << arr[i];
	cout << "}";
	return out;
}
template<class T> ostream &operator << (ostream& out, const vector<vector<T> >& arr) {
	cout << "{\n";
	for (auto& vec : arr)cout << "  " << vec << ",\n";
	cout << "}";
	return out;
}
template<class T> istream &operator >> (istream& in, vector<T>& arr) {
	for (auto& i : arr)cin >> i; return in;
}

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

  string s;cin >> s;

  int tmp = 0;
  int ans = 0;
  REP(i,3){
  	if(s[i] == 'R') tmp++;
  	else{
  		ans = max(ans,tmp);
  		tmp = 0;
  	}
  }
  if(tmp != 0)ans = max(ans,tmp);
  cout << ans << '\n';
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<"Hello World"<<endl;
    }
    else
    {
        int a=0;
        int b=0;
        cin>>a>>b;
        cout<<a+b<<endl;
    }
    return 0;
}


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

int main(void) {

int ar[100][100];
char *ptr;
int z,i,j,count;
char str[100]={'\0'};
char *ln;

fgets(str, 100, stdin); // 入力："123456\n"
ln = strchr(str, '\n'); /* 改行文字を検索 */
if (ln != NULL) { /* 改行が読み取られていたかどうか */
   *ln = '\0';    /* 改行文字を終端文字に置き換える */
}
else {            /* 入力ストリーム上に文字が残ってる場合 */
   while (1) {    /* 改行文字が読み取られるまで空読みする */
       z = getchar();
      if (z == '\n' || z == EOF) break;
   }
}

	count=0;
    
    ptr = strtok(str, " ");
    i = atoi(ptr);
    
    ar[0][count]=i;
    count=count+1;
    
    
    // 2回目以降
    while(ptr != NULL) {
        // strtok関数により変更されたNULLのポインタが先頭
        ptr = strtok(NULL, " ");
        
        // ptrがNULLの場合エラーが発生するので対処
        if(ptr != NULL) {
		    i = atoi(ptr);
		      ar[0][count]=i;
    		count=count+1;
        }
    }

int N,M,C;

N=ar[0][0];
M=ar[0][1];
C=ar[0][2];


int B[100];

fgets(str, 100, stdin); // 入力："123456\n"
ln = strchr(str, '\n'); /* 改行文字を検索 */
if (ln != NULL) { /* 改行が読み取られていたかどうか */
   *ln = '\0';    /* 改行文字を終端文字に置き換える */
}
else {            /* 入力ストリーム上に文字が残ってる場合 */
   while (1) {    /* 改行文字が読み取られるまで空読みする */
       z = getchar();
      if (z == '\n' || z == EOF) break;
   }
}

	count=0;
    
    ptr = strtok(str, " ");
    i = atoi(ptr);
    
    B[count]=i;
    count=count+1;
    
    
    // 2回目以降
    while(ptr != NULL) {
        // strtok関数により変更されたNULLのポインタが先頭
        ptr = strtok(NULL, " ");
        
        // ptrがNULLの場合エラーが発生するので対処
        if(ptr != NULL) {
		    i = atoi(ptr);
		      B[count]=i;
    		count=count+1;
        }
    }
int A[100][100];

int NN=0;

for(NN=0;NN<N;NN=NN+1){

fgets(str, 100, stdin); // 入力："123456\n"
ln = strchr(str, '\n'); /* 改行文字を検索 */
if (ln != NULL) { /* 改行が読み取られていたかどうか */
   *ln = '\0';    /* 改行文字を終端文字に置き換える */
}
else {            /* 入力ストリーム上に文字が残ってる場合 */
   while (1) {    /* 改行文字が読み取られるまで空読みする */
       z = getchar();
      if (z == '\n' || z == EOF) break;
   }
}

	count=0;
    
    ptr = strtok(str, " ");
    i = atoi(ptr);
    
    A[NN][count]=i;
    count=count+1;
    
    
    // 2回目以降
    while(ptr != NULL) {
        // strtok関数により変更されたNULLのポインタが先頭
        ptr = strtok(NULL, " ");
        
        // ptrがNULLの場合エラーが発生するので対処
        if(ptr != NULL) {
		    i = atoi(ptr);
    A[NN][count]=i;
    		count=count+1;
        }
    }

}



//printf("%d\n",N);
//printf("%d\n",M);
//printf("%d\n",C);
//printf("%d\n",B[0]);
//printf("%d\n",B[1]);
//printf("%d\n",B[2]);
//printf("%d\n",A[1][0]);
//printf("%d\n",A[1][1]);
//printf("%d\n",A[1][2]);

count=0;

for(NN=0;NN<N;NN=NN+1){

int ans=0;

int MM;

for(MM=0;MM<M;MM=MM+1){

	ans=ans+B[MM]*A[NN][MM];
	
}

ans=ans+C;

if(       ans              >0    ){
count=count+1;
}




}

printf("%d\n",count);


    return 0;
}


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

int n,m;
vector<int> a[100001],dp(100001);
vector<bool> vis(100001);
vector<int> indeg(100001);

void dfs(int u,int p)
{
    queue<int> q;
    for(int i = 1; i <= n; i++){
        if(indeg[i] == 0){
            vis[i] = 1;
            dp[i] = 0;
            q.push(i);
        }
    }
    while(!q.empty())
    {
        int u = q.front();
        q.pop();
        for(auto i : a[u])
        {
            indeg[i]--;
            
            if(indeg[i] == 0 && vis[i] == 0)
            {
                dp[i] = max(dp[i],dp[u] + 1);
                q.push(i);
                vis[i] = 1;
            }
        }
    }
    /*
    vis[u] = 1;
    for(auto i : a[u])
    {
        if(i == p)
        {
            continue;
        }
        if(vis[i])
        {
            dp[i] = max(dp[i], dp[u] + 1);
        }
        else
        {
            dp[i] = dp[u] + 1;
            dfs(i,u);
        }
    }*/
}

int main()
{
    cin >> n >> m ;
    for(int i = 0; i < m; i++)
    {
        int u,v;
        cin >> u >> v;
        a[u].push_back(v);
        indeg[v]++;
    }
    for(int i = 1; i <= n; ++i)
    {
        if(indeg[i] == 0 && vis[i] == 0){
            dfs(i,0);
        }
    }
    int mx = 0;
    for(int i = 1; i <= n; ++i)
        mx = max(mx,dp[i]);
    cout << mx << '\n' ;
    return 0;
}

Measured memory_bytes: 6528
import java.math.*

fun main(args: Array<String>) {
    val (N, C) = readInputLine().split(" ").map { it.toInt() }
    
    val changeCost = Array(C) { readInputLine().split(" ").map { it.toInt() }.toIntArray() }
    
    val colorCnt = Array(3) { IntArray(C) }
    
    for (i in 0 until N) {
        readInputLine().split(" ").forEachIndexed { j, c -> colorCnt[(i + j + 2) % 3][c.toInt() - 1]++ }
    }
    
    var ans = Int.MAX_VALUE
    
    for (i in 0 until C) {
        val tmp1 = colorCnt[0].foldIndexed(0) { index, acc, cnt -> acc + changeCost[index][i] * cnt }
        for (j in 0 until C) {
            if (i == j) {
                continue
            }
            val tmp2 = colorCnt[1].foldIndexed(0) { index, acc, cnt -> acc + changeCost[index][j] * cnt }
            for (k in 0 until C) {
                if (i == k || j == k) {
                    continue
                }
                val tmp3 = colorCnt[2].foldIndexed(0) { index, acc, cnt -> acc + changeCost[index][k] * cnt }
                ans = Math.min(ans, tmp1 + tmp2 + tmp3)
            }
        }
    }
    
    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}


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

char c[3][3];
char ans[3];

int main(){
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin>>c[i][j];
            if(i==j)ans[i]=c[i][j];
        }
    }
    cout<<ans[0]<<ans[1]<<ans[2]<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <istream>
#include <ostream>

#include <cstdlib>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define rep(i,n) for(ll i=0; i < (n); ++i)
#define rrep(i,n) for(ll i=((n)-1); i >= 0; --i)

#define OPLT(T) bool operator<(const T & lop_, const T & rop_)
#define OPEQ(T) bool operator==(const T & lop_, const T & rop_)

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

istream& operator>>(istream& istr, __float128& obj) { double d; istr >> d; obj = d; return istr; };
ostream& operator<<(ostream& ostr, __float128& obj) { ostr << static_cast<double>(obj); return ostr; };

ll N, W;
vector<vector<pii> > v(4);

ll solve(int dep, ll weight, ll val) {
	if(dep >= v.size()) {
		if(weight <= W)
			return val;
		return 0;
	}
	ll res = 0;
	for(int i = 0; i <= v[dep].size(); i++) {
		if(i) {
			weight += v[dep][i-1].fi;
			val += v[dep][i-1].se;
		}
		res = max(res, solve(dep+1, weight, val));
	}
	return res;
}

int main() {
	cin >> N >> W;
	int a;
	rep(i,N) {
		pii tmp;
		cin >> tmp.fi >> tmp.se;
		if(i) {
			v[tmp.fi-a].push_back(tmp);
		}
		else {
			a = tmp.fi;
			v[0].push_back(tmp);
		}
	}
	rep(i,4) sort(v[i].rbegin(), v[i].rend());

	cout << solve(0,0,0) << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		int A = sc.nextInt();
		int B = sc.nextInt();

		int n = 1;
		int tap = 0;

		while (n < B) {
			n += A - 1;
			tap++;
		}
		System.out.println(tap);
	}

}


Measured memory_bytes: 35648
#include<stdio.h>

int main(){
  int h,w;
  int i,j;

  while (1){
    scanf("%d %d", &h, &w);
    if(h==0 && w==0){
      break;
    }
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
        if(((i%2)+(j%2))%2==0){
          printf("#");
        }
        else{
          printf(".");
        }
      }
      printf("\n");
    }
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 2096
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#ifdef DEBUG
#define line() cout << "[" << __LINE__ << "] ";
#define dump(i) cout << #i ": " << i << " ";
#define dumpl(i) cout << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

ll g(ll n)
{
    switch (n % 4)
    {
    case 0:
        return n;
    case 1:
        return 1;
    case 2:
        return n + 1;
    case 3:
        return 0;
    }
}

int main(int argc, char const *argv[])
{
    ll a, b;
    cin >> a >> b;
    cout << (g(a - 1) ^ g(b)) << endl;

    return 0;
}

//0 1 2 3 4 5 6 7 8 0 1 3 0 4


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define PI          3.1415926535897932384626433832795l

#define pb push_back
#define mp make_pair
#define lb lower_bound // First element which is not less than val
#define ub upper_bound // First element greater than val
#define f first
#define s second

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vpii = vector<pair<int,int>>;
using vpll = vector<pair<ll,ll>>;

using pii = pair<int,int>;
using pll = pair<ll,ll>;

#define endl '\n'
#define re return
#define repz(i, a) for (ll i = 0; i < (a); i++)
#define vecin(n,v) for(ll i = 0; i < n; i++) cin>>v[i];
#define full(v) v.begin(),v.end()

void solve()
{
  int n;
  cin >> n;
  vi a(n);
  vecin(n,a);

  if (n==1)
  {
    cout << 1 << endl;
    re;
  }

  int l = 0, r = 1;
  int curr = a[0];
  ll ans = 0;
  while (l < n)
  {
    while (r < n && (a[r]&curr)==0)
    {
      curr |= a[r];
      r++;
    }
    //cout << l << " " << r << endl;

    ans += r-l;

    // Remove the last guy!!
    curr ^= a[l];
    l++;
  }

  cout << ans << endl;
}

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

  ll t = 1;
  //cin >> t;
  while (t--)
  {
    solve();
  }
}



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

#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;

  
int main(){
  ll n;
  cin >> n;
  
  ll m = sqrt(n);
  
  ll ans = LONG_MAX;
  for(int i = 1; i <= m; i++){
    ll aa = i;
    if(n%aa != 0){
      continue;
    }
    else{
      ll c = aa + n/aa - 2;
      //cout << "aa=" << aa << ", c=" << c << endl;
      ans = min(ans, c);
    }
  }
    
  cout << ans << endl;
  
}





Measured memory_bytes: 256
n = int(input())
abc = [tuple(map(int,input().split())) for i in range(n)]

dp = [[0,0,0] for i in range(n+1)]


for i in range(n):
    for j in range(3):
        for k in range(3):
            if j == k:
                continue
            dp[i+1][k] = max(dp[i+1][k],dp[i][j]+abc[i][k])

print(max(dp[-1]))

Measured memory_bytes: 45152
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    int N;cin>>N;
    string s;
    cin>>s;
    int p[10]={};
    vector<bool> can(1000,false);
    vector<bool> used1(10,false),used2(10,false);
    REP(i,N) p[s[i]-'0']=i;
    REP(i,N){
        used2.assign(10,false);
        rep(j,i+1,N){
            if(used2[s[j]-'0']) continue;
            REP(k,10){
                if(p[k]>j) can[(s[i]-'0')*100+(s[j]-'0')*10+k]=true;
            }
            used2[s[j]-'0']=true;
        }
    }
    int ans=0;
    REP(i,1000) if(can[i]) ans++;
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){

   int n,a,b;
   cin >> n >> a >> b;

   int ans = min(a*n,b);
   cout << ans << endl;


   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define g(a, b) __gcd((a), (b))
#define l(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
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; }
template<class T, class U>T rem(T a, U b) { return a - b*floor(a/b); }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        string S;
        cin >> S;
        ll ans = -1;
        if (S == "SUN") ans = 7;
        if (S == "MON") ans = 6;
        if (S == "TUE") ans = 5;
        if (S == "WED") ans = 4;
        if (S == "THU") ans = 3;
        if (S == "FRI") ans = 2;
        if (S == "SAT") ans = 1;
        cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
 
int main() {
  int ans=0;
  string a;
  cin>>a;
  for(int i=0;i<3;i++) {
    if(a.at(i)=='1') {
      ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
        string input = ReadLine();
        DateTime dateTime = DateTime.Parse(input);
        if (dateTime.Month < 5)
        {
            WriteLine("Heisei");
        }
        else
        {
            WriteLine("TBD");
        }
        ReadKey();
    }
}

static class MyUtil
{
    public static int[] ReadIntArray()
    {
        return Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
    }

    /// <summary>
    /// <see cref="IEnumerable{T}"/>の各要素を並べてコンソールに出力します。各要素の間には半角スペースが一つ入ります。
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="ts"></param>
    public static void WriteToConsole<T>(this IEnumerable<T> ts)
    {
        StringBuilder stringBuilder = new StringBuilder();
        foreach (T t in ts)
        {
            stringBuilder.Append(t.ToString());
            stringBuilder.Append(" ");
        }
        stringBuilder.Remove(stringBuilder.Length - 1, 1);
        Console.WriteLine(stringBuilder.ToString());
    }
}


Measured memory_bytes: 13660
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;

int main() {
    string s, t;
    cin >> s >> t;
    int n = sz(s), m = sz(t);
    vector<vector<int>> is(26);
    rep(i, n) is[s[i] - 'a'].push_back(i);
    rep(i, n) is[s[i] - 'a'].push_back(i+n);
    ll ans = 0;
    int p = 0;
    rep(i, m) {
        int c = t[i] - 'a';
        if (sz(is[c]) == 0) {
            puts("-1");
            return 0;
        }
        p = *lower_bound(is[c].begin(), is[c].end(), p) + 1;
        if (p >= n) {
            p -= n;
            ans += n;
        }
    }
    ans += p;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1724
import Data.List (sortOn)
import Data.Maybe (fromJust)
import Control.Monad (replicateM, foldM)
import qualified Data.ByteString.Char8 as BS


toInt = fst . fromJust . BS.readInt

toIntPair =
    let
        toTuple = \(a : b : _) -> (a, b)
    in
        toTuple . map toInt . BS.words

sortByLimit = sortOn snd

accepts acc (a, b) =
    let
        total = a + acc
    in
        if total <= b then Just total else Nothing

work = foldM accepts 0

main = do
    n <- toInt <$> BS.getLine
    pairs <- map toIntPair <$> replicateM n BS.getLine

    case work . sortByLimit $ pairs of
        Nothing -> putStrLn "No"
        _       -> putStrLn "Yes"


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;

const ll MOD = 1000 * 1000 * 1000 + 7;

int main() {
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    vector<ll> a(n + 2);
    vector<ll> b(n + 2);
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    for (int i = 1; i <= n; i++)
        cin >> b[i];
    ll ways = 1;
    for (int i = 1; i <= n; i++) {
        ll val1 = -1;
        ll val2 = -1;
        if (a[i] != a[i - 1])
            val1 = a[i];
        if (b[i] != b[i + 1])
            val2 = b[i];
        if (val1 == -1 && val2 == -1) {
            ways = ways * min(a[i], b[i]) % MOD;
            continue;
        }
        if ((val1 == -1 && a[i] >= b[i]) || (val2 == -1 && b[i] >= a[i]) || val1 == val2) 
            continue;
        ways = 0;
        break;
    }
    cout << ways << endl;
    return 0;
}


Measured memory_bytes: 1792