akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define sz(s) (int)(s).size()
#define sqr(x) (x) * (x)
#define re(i, n) for (int i = 1; i <= n; i ++)
#define pb push_back
#define finish(x) return cout << x << endl, 0
#define MP make_mair
#define trav(x, a) for(auto& x: a)
#define all(x) (x).begin(),(x).end()
#define pi acis(-1)
#define Sor(x) sort(all(x))
#define Rev(x) reverse(all(x))
#define F first
#define S second
#define I insert
#define N 2222222
#define MOD 1000000007
#define nol(a) memset(a, 0, sizeof(a))
#define minus(a) memset(a, 0xff, sizeof(a))
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define deb(x) cerr << #x << " = " << x << '\n'
#define eb emplace_back
#define vll vector<long long>
#define file freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout)
#define INF 1000000021

using namespace std;
using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
//typedef vector<ll> vll;
typedef tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
//const ld pi = 2 * acos(0.0);
template <typename _T>inline void read(_T &f){f = 0; _T fu = 1; char c = getchar();while (c < '0' || c > '9') { if (c == '-') { fu = -1; } c = getchar();}    while (c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar();}f *= fu;}
template <typename T>void print(T x){if (x < 0) putchar('-'), x = -x;if (x < 10) putchar(x + 48);else print(x / 10), putchar(x % 10 + 48);}
template <typename T> void print(T x, char t){print(x); putchar(t);}
template <class T> bool umin(T& a, T b) {if(a>b){a = b; return 1;}return 0;}
template <class T> bool umax(T& a, T b) {if(a<b){a=b; return 1;}return 0;}
template <class T, class TT> bool pal(T a, TT n){int k = 0; for(int i =0; i <= n / 2; i ++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}
template<class T>void eras(vector<T>& a,T b){a.erase(find(a.begin(),a.end(),b));}
//int yil[13] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

ll powmod(ll a, ll b, ll m = MOD){ll r = 1;while(b>0){if(b&1)r=r*a%m;a=a*a%m;b>>=1;}return r;}
string to_upper(string a)
{
	for (int i = 0; i < (int)a.size(); ++ i) if (a[i] >= 'a' && a[i] <= 'z') a[i] -= 'a' - 'A';
	return a;
}
string to_lower(string a)
{
	for (int i = 0; i < (int)a.size(); ++ i) if (a[i] >= 'A' && a[i] <= 'Z') a[i] += 'a' - 'A';
	return a;
}
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
	string s, x;
	cin >> s >> x;
	int ans = 0;
	for (int i = 0; i < s.size(); i ++)
	{
		if (s[i] != x[i])
			ans ++;
	}
	cout << ans;






}



Measured memory_bytes: 3808
import collections
n = int(input())
arr = collections.Counter()
def factorize(num):
    while num % 2 == 0:
        arr[2] += 1
        num //= 2
    f = 3
    while f ** 2 <= n:
        if num % f == 0:
            arr[f] += 1
            num //= f
        else:
            f += 2
    if num != 1:
        arr[num] = 1

factorize(n)
varr = list(arr.values())
ans = 0
for i in varr:
    c = 1
    while c <= i:
        i -= c
        ans += 1
        c += 1
print(ans)



Measured memory_bytes: 9416
N,M,C = list(map(int, input().split()))
Bs = list(map(int, input().split()))
As = []
for _ in range(N):
    As.append(list(map(int, input().split())))
counter = 0
for n in range(N):
    if sum([a * Bs[i] for i, a in enumerate(As[n])]) + C > 0:
        counter += 1
print(counter)

Measured memory_bytes: 3064
L, R = map(int, input().split())
counter = []
ite = 0
for i in range(L, R+1):
    counter.append(i)
    ite += 1
    if ite > 2021:
        break

kouho = 2019**2
for j in counter:
    for k in range(L, j):
        if kouho > (j * k) % 2019:
            kouho = (j*k) % 2019


print(kouho)


Measured memory_bytes: 3060
A=[int(x) for x in input().split()]
A.sort()

if (A[2]-A[0])%2==0 and (A[2]-A[1])%2==0:
  print((A[2]-A[0])//2+(A[2]-A[1])//2)
elif (A[2]-A[0])%2==1 and (A[2]-A[1])%2==1:
  print((A[2]-A[0])//2+(A[2]-A[1])//2+1)
else:
  print((A[2]-A[0])//2+(A[2]-A[1])//2+2)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define INF 2000000000
typedef long long int ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define getbit(n,i) (((n)&(1<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1<<(i))))
#define setbit1(n,i) ((n)(1<<(i)))
#define togglebit(n,i) ((n)^(1<<(i)))
#define lastone(n) ((n)&(-(n)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define fi first
#define se second
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("d",&a,&b)
#define PI (acos(-1))
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod (1000000007)
#define asz 500005

ll BIGMOD ( ll a, ll p, ll m )
{
    ll result = 1;
    ll x = a;

    while ( p )
    {
        if ( p & 1 ) //p is odd
        {
            result = ( result * x ) % m;
        }
        x = ( x * x ) % m;
        p = p >> 1;
    }

    return result;
}

int main()
{
   //fastread;
   int n;
   cin>>n;
   string str;
   cin>>str;
   deque<char>d;
   d.push_back(str[0]);
   for(int i=1;i<n;i++)
   {
       if(str[i-1]==str[i]) continue;
       else d.push_back(str[i]);
   }
   cout<<d.size()<<endl;

  return 0;
}


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

using namespace std;

int main()
{
	int r;
	cin >> r;

	if (r < 1200) {
		cout << "ABC" << endl;
	} else if (r < 2800) {
		cout << "ARC" << endl;
	} else {
		cout << "AGC" << endl;
	}

	return 0;
}


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

int main(void){
    int n, k;
    cin >> n >> k;
    vector<int> dis(n);
    int count = 0;
    for (int i = 0; i < n; i++){
        cin >> dis.at(i);
        count += min(dis.at(i), abs(k - dis.at(i))) * 2;
    }
    cout << count << endl;
}


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

int main(){
    int n,m;
    cin >> n >> m;
    int q = m / n;
    int ans=0;
    for(int i=q;i>0;i--){
        if(m % i == 0){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>

using namespace std;

typedef  long long ll;
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;}

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

long long INF = 1LL<<60;
long long dp[100010];
int h[100010];
int main(){

    int a,b,c,d,out;
    string o;
    cin>>a>>b>>c;
    if(a+b+c>=22)
    cout<<"bust"<<endl;
    else
    cout<<"win"<<endl;
    return 0;
}




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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

#include <bits/stdc++.h>
using namespace std;

constexpr ll INF = 1e15;

constexpr ll mod = 1e9 + 7;

template<typename T>
void cmpmax(T& reference, T value) {
	reference = max(reference, value);
}

template<typename T>
void cmpmin(T& reference, T value) {
	reference = min(reference, value);
}

int main() {
	int n;
	cin >> n;
	vector<int> as(n);
	vector<int> counts(4, 0);
	rep(i, n) {
		cin >> as[i];
		counts[as[i]]++;
	}

	vector<vector<vector<double>>> dp(n + 1, vector<vector<double>>(n + 1, vector<double>(n+1, -1)));
	
	//dp[i][j][k]...1枚の皿がi個、2枚の皿がj個、3枚の皿がk個のときに、必要な手数の期待値
	//dp[i][j][k] = (n-i-j-k) / n * dp[i][j][k] + i / n * dp[i-1][j][k] + j / n * dp[i+1][j-1][k] + k / n * dp[i][j+1][k-1] + 1
	//(i+j+k)/n * dp[i][j][k] = i / n * dp[i-1][j][k] + j / n * dp[i+1][j-1][k] + k / n * dp[i][j+1][k-1] + 1

	dp[0][0][0] = 0;
	const double dn = n;
	rep(k, counts[3] + 1) {
		rep(j, n + 1) {
			if (k + j> n) continue;
			rep(i, n + 1) {
				if (i == 0 && j == 0 && k == 0) continue;
				if (i + j + k > n) continue;
				double right = dn;
				if (i > 0) right += i * dp[i - 1][j][k];
				if (j > 0 && i < n) right += j * dp[i + 1][j - 1][k];
				if (k > 0 && j < n) right += k * dp[i][j + 1][k - 1];
				right *= 1.0 / (i + j + k);
				dp[i][j][k] = right;
			}
		}
	}
	cout << setprecision(10) << dp[counts[1]][counts[2]][counts[3]] << endl;
	return 0;
}


Measured memory_bytes: 216960
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

int p[200],q[50];

int f(int n,int m,int c){
	if(c==4&&n>0)return 5;
	if(n<10)return min(c+n/4+n%4,5);
	int rec=5,i=0;
	while(p[i]<n/(4-c))i++;
	for(i;p[i]<=m;i++)rec=min(rec,f(n-p[i],min(p[i],n-p[i]),c+1));
	return rec;
}

int g(int n,int m,int c,int *M){
	if(c==*M)return *M;
	if(n<165)return c+n/35+n%35;
	int i=44;
	while(q[i]>m)i--;
	for(i;i>0;i--){
		*M=min(*M,g(n-q[i],min(q[i],n-q[i]),c+1,M));
	}
	return *M;
}

int main(){
	for(int i=0;(i+1)*(i+2)*(i+3)/6<=1000000;i++)p[i]=(i+1)*(i+2)*(i+3)/6;
	for(int i=0;(4*i+1)*(4*i+2)*(4*i+3)/6<=1000000;i++)q[i]=(4*i+1)*(4*i+2)*(4*i+3)/6;
	int N;
	while(cin>>N){
		if(!N)return 0;
		int ans=9999;
		cout<<f(N,N,0)<<" "<<g(N,N,0,&ans)<<endl;
	}
}

Measured memory_bytes: 864
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn =2e5+5;
const int mod=10000019;
const int inf=0x3f3f3f;
char a[maxn];
int b[maxn];
int main()
{
    int n;
    scanf("%d",&n);
    scanf("%s",a);
    int num=0;
    for(int i=0; i<n; i++)
    {
        if(a[i]=='R')num++;
        b[i]=num;
    }
    printf("%d\n",num-b[num-1]);
    return 0;
}


Measured memory_bytes: 4800
#include <iostream>

using namespace std;

typedef long long LL;

LL gcd(LL x, LL y) {
  return y ? gcd(y, x % y) : x;
}

int main() {
  LL n; cin >> n;
  LL ans;

  for (int i = 0; i < n; i++) {
      LL a; cin >> a;
      if (i == 0) { ans = a; }
      else { ans = gcd(ans, a); }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
N = gets.to_i
Ps = (0...3).map{ |i|
  gets.split.map{ |a| [a.to_i, 2-i] }
}.flatten(1).sort
#p Ps

n = [0,0,0,1]
Ps.each{ |a,i|
  n[i] += n[i+1]
  #p n
}
p n[0]

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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if((a*100+b*10+c)%4 == 0){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    s="MARCH"
    n=int(input())
    k=[0]*5
    for _ in range(n):
        t=input()[0]
        if t in s: k[s.index(t)]+=1
    from itertools import combinations
    A=combinations(range(5),3)
    ans=0
    for a,b,c in A:
        ans+=k[a]*k[b]*k[c]
    print(ans)
resolve()

Measured memory_bytes: 40556
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
using namespace std;

int main(){
    // あとで消す
    //std::ifstream in("ain4.txt");
    //std::cin.rdbuf(in.rdbuf());

    
    int A,B,C;
    cin >> A >> B >> C;

    if(A==B && A!=C){
        cout << "Yes" << endl;
    }else if(A==C && A!=B){
        cout << "Yes" << endl;
    }else if(B==C && A!=B){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    

    return 0;
}


Measured memory_bytes: 256
import math

def main():
    a, b, x = map(int, input().split())
    if x < a * a * b / 2:
        tan = 2 * x / (b * b * a)
        print(90 - math.degrees(math.atan(tan)))
    else:
        tan = (2 / a) * (b - x / a**2)
        print(math.degrees(math.atan(tan)))


if __name__ == '__main__':
    main()


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

char s[4009];
struct bin{
	bitset<4009> bit;
	int L;
	void inp(){
		scanf("%s",s);
		L = strlen(s);
		reverse(s,s+L);
		--L;
		for(int i=0; i<=L; i++)if(s[i] == '1')
			bit.set(i);
		else
			bit.reset(i);
	}
	void add1(){
		for(int i=0; i<=L+1; i++)if(bit.test(i))bit.reset(i);else{
			bit.set(i);
			break;
		}
		if(bit.test(L+1))++L;
	}
	void out(){
		printf("##");
		if(L==-1)printf("0\n");else{
			for(int i=L; i>=0; i--)printf("%d",bit.test(i));
			puts("");
		}
	}
};

int n;
bin Y,X,Z;

bool gaussian(bin&A, bin&B, bin&C){
	C = B;
	if(A.L > B.L){
		return true;
	}
	int dif = B.L - A.L;
	bin g = A;
	g.bit <<= dif;
	g.L += dif;
	while(dif >= 0){
		if(C.bit.test(C.L))
			C.bit ^= g.bit;
		g.bit >>= 1;
		C.L--;
		dif--;
	}
	while(C.L >=0 && !C.bit.test(C.L))C.L--;
	return C.L >= 0;
}

bin gcd(bin A, bin B){
	bin C;
	if(!gaussian(A, B, C))return A;
	return gcd(C,A);
}

#define mod 998244353
int add(int x,int y){return (x+=y)<mod?x:x-mod;}
int mul(int x,int y){return (int)((long long int)(x)*y%mod);}
int p2[4009];
int main(){
	scanf("%d",&n);
	X.inp();X.add1();
	Y.inp();
	for(int i=1; i<n; i++){
		Z.inp();
		Y = gcd(Y, Z);
	}
	p2[0] = 1;
	for(int i=1; i<=X.L; i++)p2[i] = add(p2[i-1],p2[i-1]);
	bin cur = Y;
	int res= 0;
	for(int i=X.L; i>=0; i--){
		if(!X.bit.test(i))continue;
		if(i >= cur.L){
			res=add(res, p2[i - cur.L]);
			continue;
		}
		bin B;
		gaussian(cur, X, B);
		B.bit ^= X.bit;
		bool ff = false;
		for(int j=cur.L-1; j>=0; j--)if(B.bit.test(j) ^ X.bit.test(j)){
			if(!B.bit.test(j) && X.bit.test(j))
				ff = true;
			break;
		}
		if(ff)res=add(res,1);
		break;
	}
	printf("%d\n",res);
	return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

int main()
{
  i64 A[3][3];
  for (i64 i = 0; i < 3; i++)
    for (i64 j = 0; j < 3; j++)
      cin >> A[i][j];
  i64 N;
  cin >> N;
  vector<i64> b(N);
  for (i64 i = 0; i < N; i++)
    cin >> b[i];
  bool ok[3][3] = {};
  for (i64 i = 0; i < 3; i++)
    for (i64 j = 0; j < 3; j++)
      for (i64 k = 0; k < N; k++)
        if (A[i][j] == b[k])
          ok[i][j] = true;
  bool ans = false;
  for (i64 i = 0; i < 3; i++)
    if (ok[i][0] && ok[i][1] && ok[i][2])
      ans = true;
  for (i64 i = 0; i < 3; i++)
    if (ok[0][i] && ok[1][i] && ok[2][i])
      ans = true;
  if (ok[0][0] && ok[1][1] && ok[2][2])
    ans = true;
  if (ok[0][2] && ok[1][1] && ok[2][0])
    ans = true;
  if (ans)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int main(void){
  char s[10];
  int i,min=9999;
  scanf("%s",s);
  for(i=0;i<strlen(s)-2;i++){
    int x=s[i]-'0',y=s[i+1]-'0',z=s[i+2]-'0';
    int sa=abs((100*x+10*y+z)-753);
    if(sa<min) min=sa;
  }
  printf("%d",min);
  return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    int N, K, X, Y;
    cin >> N >> K >> X >> Y;
    cout << min(N, K) * X + max(N - K, 0) * Y << 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 n = sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		int[] c = new int[n];

		for (int i=0;i<n;i++) {
			a[i]=sc.nextInt();
			b[i]=sc.nextInt();
			c[i]=sc.nextInt();
		}

		int[] ansA = new int[n];
		int[] ansB = new int[n];
		int[] ansC = new int[n];

		ansA[0]=a[0];
		ansB[0]=b[0];
		ansC[0]=c[0];

		for (int i=1;i<n;i++) {
			ansA[i]=Math.max(ansB[i-1], ansC[i-1])+a[i];
			ansB[i]=Math.max(ansC[i-1], ansA[i-1])+b[i];
			ansC[i]=Math.max(ansA[i-1], ansB[i-1])+c[i];
		}
		System.out.println(Math.max(Math.max(ansA[n-1], ansB[n-1]), ansC[n-1]));
	}

}

Measured memory_bytes: 94204
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb(x) push_back(x);
#define mp(x,y) make_pair(x,y)
#define mem(dp,a) memset(dp,a,sizeof dp);
#define all(a) a.begin(),a.end()
#define sall(a) sort(all(a))
#define X first
#define Y second
typedef long long int ll;
typedef pair<ll,ll> pp;

#define debug(x) cout << #x << " :: "<< x <<"\n";
#define debug2(x,y) cout << #x << " :: "<< x << "\t" << #y << " :: " << y << "\n";
#define debug3(x,y,z) cout << #x << " :: "<< x << "\t" << #y << " :: " << y << "\t" << #z << " :: " << z << "\n";
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree< pp , null_type,less< pp >, rb_tree_tag,tree_order_statistics_node_update>

ll power(ll a,ll b)
{
	if(b==0)
		return 1;
	ll c=power(a,b/2);
	if(b%2==0)
		return c*c;
	else
		return c*c*a;
}

const ll N=1e7+1;
ll f[N];

int main()
{
    boost
    for(ll i=1;i<N;i++) {
        for(ll j=i;j<N;j+=i)    {
            f[j]++;
        }
    }
    ll n,ans=0;
    cin >> n ;
    for(ll i=1;i<=n;i++)    {
        ans+=(f[i]*i);
    }
    cout << ans ;
    return 0;
}


Measured memory_bytes: 81776
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
        int[] arr = {61,230,865,3247,12185,45719,171531,643550,2414454,9058467,33985227,127504505,478366600,794717734,733354121,261943303,776803305,580025381,51688048,44657419,737209731,604119499,159693437,858533109,639056669,549054109,996291083,531294469,23314687,783022045,855462856,649970414,68697295,409213624,604356692,88638656,978442997,534833116,763737161,785892908,123883652,639213333,181836645,998121103,124885216,501575626,39816123,113468411,799008836,775465589,256852905,664630886,971550783,751629411,51018086,702530485,725438992,696683714,792638194,221791721,149602322,414054379,986519078,981760191,305799096,515140586,406959393,975058685,245601370,324759692,673385295,191483611,570246669,427196161,781042769,569725155,842176273,25328739,847501730,206282374,353770801,323137024,371653459,940737264,123820509,915711339,847205021,252858375,718889563,866398347,738390145,133009077,333099663,170591295,329869205,616680192,597534442,388130742};
        int N = Integer.parseInt(br.readLine())-3;
        out.write(String.valueOf(arr[N]));
        out.flush();
    }
}

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

const int INF = 1e9;

int main() {
    int n, m;
    while (cin >> n >> m, n | m) {
        vector<int> c(m, 0), x(n, 0);
        for (int i = 0; i < m; i++) cin >> c[i];
        for (int i = 0; i < n; i++) cin >> x[i];
        // dp[i][j] := i個目の信号まででyがjのときの最小値
        vector<vector<int> > dp(20005, vector<int>(256, INF));
        dp[0][128] = 0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < 256; j++) {
                if (dp[i][j] == INF) continue;
                for (int k = 0; k < m; k++) {
                    int y = max(0, min(255, j + c[k]));
                    dp[i + 1][y] = min(dp[i + 1][y], dp[i][j] + (x[i] - y) * (x[i] - y));
                }
            }
        }
        int ans = 1e9;
        for (int i = 0; i < 256; i++) ans = min(ans, dp[n][i]);
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 23660
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

const ll nmax = 1e9 + 7;
const ll Mod = 998244353;
const double PI = 2 * asin(1);

int main(){
  ll N; cin >> N;
  ll A[N];
  for (int i = 0; i < N; i++) cin >> A[i];

  ll ans = 0;
  while (true){
    ll sum = 0;
    vector <ll> now(N);
    for (int i = 0; i < N; i++){
      now[i] = A[i] / N;
      sum += now[i];
    }
    if (sum == 0) break;

    ans += sum;
    for (int i = 0; i < N; i++){
      A[i] = A[i] - now[i] * N + (sum - now[i]);
    }
  }
  cout << ans << endl;

  return 0;
}


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


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

    if(a+b+c >= 22) cout << "bust" << endl;
    else cout << "win" << endl;
    
    return 0;
}

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

int main() {
  ll A,B,K;
  cin >> A >> B >> K;
  if (K > A){
    if (K < A+B){cout << 0 << ' ' << A+B-K << endl;}
    else {cout << 0 << ' ' << 0 << endl;}  
  }
  else{cout << A-K << ' ' << B << endl;}
}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;

const ll mod = 1e9+7;
const int maxn = 1e6 + 5;







int n;

ll tot = 0;
map<ll,ll> mp;


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

    cin>>n;
    for (int i=0; i<n; i++) {
	ll x; cin>>x;
	tot += x;
	mp[x]++;
    }


    int q; cin>>q;

    while (q--) {
	ll from, to; cin>>from>>to;
	ll cnt = mp[from];
	tot -= cnt*from;
	tot += cnt*to;
	mp.erase(from);
	mp[to] += cnt;
	cout<<tot<<"\n";
    }
    
    
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<int,int>;

const int MOD = 1e9 + 7;

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

    int n;
    cin >> n;
    vector<int> x(n);
    rep(i, n){
        cin >> x[i];
    }

    ll ans = MOD;
    for (int i = 1; i < 100; ++i) {
        ll tot = 0;
        rep(j, n){
            tot += (i-x[j])*(i-x[j]);
        }
        ans = min(ans, tot);
    }

    cout << ans << endl;

    return 0;
}


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

int g[15][15];

int main() {
  int n;
  cin >> n;
  // 1：正直と証言、0：真偽不明と証言、-1：証言なし
  rep(i, n) rep(j, n) g[i][j] = -1;
  rep(i, n) {
    int m;
    cin >> m;
    rep(j, m) {
      int a, x;
      cin >> a >> x;
      g[i][a - 1] = x;
    }
  }

  int ans = 0;
  rep(i, 1<<n) { // 2のn乗を表すシフト演算子
    vector<int> d(n);
    rep(j, n) if (i>>j&1) { // iのjビット目が1であるかどうか 
      d[j] = 1; // 嘘つきと正直の割り当て
    }
    bool ok = true;
    rep(j,n) {
      if (d[j]) { // jが正直者だと割り当てられるなら処理を進める
        rep(k, n) {
          if (g[j][k] == -1) continue;
          if (g[j][k] != d[k]) ok = false;
        }
      }
    }
    if (ok) ans = max(ans, __builtin_popcount(i)); // 1が立っている個数を数える関数
  }
  cout << ans << endl;
  return 0;
}


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

#include<vector>
#include<string>

#include<algorithm>
#include<cmath>

#include<deque>

using namespace std;
typedef long long ll;
const ll INF = 1e12+1;
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;}

ll H, W;

int main() {
    cin >> H >> W;
    if (H % 3 == 0 || W % 3 == 0) {
        cout << 0 << endl;
        return 0;
    } 
//4 4   664->2
//5 5   88

//短い辺と並行に分断したほうが明らかに誤差は少なくなる

    ll res = INF;
    
    for (int h = 1; h <= H-1; h++) {
        ll A = h * W;
        ll B = ((H-h) / 2) * W;
        ll C = H*W - A - B;
        chmin(res, max(A,max(B,C))-min(A,min(B,C)));
        B = (W / 2) * (H-h);
        C = H*W - A - B;
        chmin(res, max(A,max(B,C))-min(A,min(B,C)));
    }
    swap(H,W);
    for (int h = 1; h <= H-1; h++) {
        ll A = h * W;
        ll B = ((H-h) / 2) * W;
        ll C = H*W - A - B;
        chmin(res, max(A,max(B,C))-min(A,min(B,C)));
        B = (W / 2) * (H-h);
        C = H*W - A - B;
        chmin(res, max(A,max(B,C))-min(A,min(B,C)));
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int x, y;
    
    while(1){
        cin >> x >> y;
        if(x == 0 && y == 0)break;
        if(x <= y){
            cout << x << " " << y << endl;
        }else{
            cout << y << " " <<x << endl;
        }
        
    }
    
}
////ITP1_3_C


Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

bool dfs(int now, int pre, vector<int> &d, vector<vector<int>> &g) {
    if (now) d[now] = d[pre] + 1;

    bool ret = false;
    for (int nxt : g[now]) {
        if (d[nxt] != -1) {
            if (d[nxt] % 2 != d[now] % 2)
                continue;
            else
                return true;
        }
        ret |= dfs(nxt, now, d, g);
    }
    return ret;
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> g(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    vector<int> d(n, -1);
    d[0] = 0;
    if (dfs(0, -1, d, g)) {
        cout << (ll)n * (n - 1) / 2 - (ll)m << endl;
        return 0;
    }

    ll odd = 0, even = 0;
    rep(i, n) {
        (d[i] % 2 == 0 ? even : odd)++;
    }
    cout << odd * even - (ll)m << endl;
}


Measured memory_bytes: 7296
#include<stdio.h>
#include<math.h>
#include<stdlib.h>

int main(void)
{
    int n, x[100], y[100], i;
    double sum=0,max=0;
    
    scanf("%d", &n);
    for(i=0; i<n; i++){
        scanf("%d", &x[i]);
    }
    for(i=0; i<n; i++){
        scanf("%d", &y[i]);
    }
    
    // p=1のとき
    for(i=0; i<n; i++){
        sum+=abs(x[i]-y[i]);
    }
    printf("%lf\n", sum);
    // p=2のとき
    sum=0;
    for(i=0; i<n; i++){
        sum+=pow(x[i]-y[i],2);
    }
    printf("%lf\n", sqrt(sum));
    // p=3のとき
    sum=0;
    for(i=0; i<n; i++){
        sum+=pow(abs(x[i]-y[i]),3);
    }
    printf("%lf\n", cbrt(sum));
    // p=∞のとき
    for(i=0; i<n; i++){
        if(abs(x[i]-y[i])>max){
            max=abs(x[i]-y[i]);
        }
    }
    printf("%lf\n", max);
    
    return 0;
}


Measured memory_bytes: 2112
#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int W=0,H=0,x=0,y=0,r=0;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    if(x>=r&&y>=r&&W-r>=x&&H-r>=y){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}



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

ans = -1
for i in range(len(s)-len(t)+1):
    u = s[i:i+len(t)]
    flag = 0
    k = i
    for index, iu in enumerate(u):
        if not (iu == "?" or iu == t[index]):
            k = index
            flag = 1
    if flag == 0:
        ans = k

if ans == -1:
    print("UNRESTORABLE")
else:
    i = 0
    word = ""
    while i < len(s):
        if i == ans:
            word += t
            i += len(t)
        elif s[i] == "?":
            word += "a"
            i += 1
        else:
            word += s[i]
            i += 1
    print(word)


Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int a,b;
    cin>>a>>b;
    cout<<a*b;
    return 0;
}

Measured memory_bytes: 3652
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

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

using namespace std;
typedef long long ll;

int main()
{
    // Input
    int a, b, h, m;
    cin >> a >> b >> h >> m;

    double hrad = 30 * h + 0.5 * m;
    double mrad = 6 * m;
    double rad = abs(hrad - mrad);
    rad = min(rad, 360-rad);
    // cout << rad << endl;

    const double PI  = 2.0 * asin(1.0); 
    double ans = sqrt(pow(a, 2) + pow(b, 2) - 2 * a * b * cos(PI / 180 * rad));
    // cout << pow(a, 2) + pow(b, 2) - 2 * a * b * cos(PI / 180 * rad) << endl;
    // cout <<  cos(PI / 180 * rad) << endl;

    cout << fixed << setprecision(20);
    cout << ans;

    return 0;
}


Measured memory_bytes: 3676
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
#include <assert.h>
typedef int64_t ll;
typedef uint64_t ull;
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)

#define MAXN (100000)
#define MOD (1000000007)

//グラフ
#define MAXV (MAXN)
int Gv;
typedef struct edge
{
    int to;
    struct edge* next;
}edge;

edge* Ge[MAXV]; //vから出てる有向辺
int Gd[MAXV]; //vの次数

// vは頂点数、指定するときは0～(v-1)
void Ginit(int v)
{
    Gv = v;
}

void Gadd(int v, int to)
{
    edge* e = malloc(sizeof(edge));
    e->to = to;
    e->next = Ge[v];
    Ge[v] = e;
    Gd[v]++;
}

// べき乗余
int64_t modpow(int64_t b, int64_t e)
{
    int64_t result = 1;
    while(e>0)
    {
        if(e&1) result = (result * b) % MOD;
        e >>= 1;
        b = (b * b) % MOD;
    }
    return result;
}

// 組み合わせ数
// nCk % MOD
ll cf[MAXN+1]; // 1*2*3*...*i
ll ci[MAXN+1]; // 1/ 1*2*3*...*i
void CombInit(ll n)
{
    cf[0] = 1;
    for(int i=1;i<=n;i++) cf[i] = cf[i-1] * i %MOD;
    ci[n] = modpow(cf[n],MOD-2);
    for(int i=n-1;i>=0;i--) ci[i] = ci[i+1] * (i+1) %MOD;
}
ll Comb(ll a,ll b)
{
    return cf[a]*ci[b]%MOD*ci[a-b]%MOD;
}


ll ans;
ll k;
void dfs(int i,int d,int p)
{
    int u = d==1? 1 : 2;
    int o = d==1? 0 : 1;
    ans = ans * Comb(k-u,Gd[i]-o) %MOD * cf[Gd[i]-o] %MOD;
    edge* e = Ge[i];
    while(e!=NULL)
    {
        if(p!=e->to) dfs(e->to, d+1, i);
        e = e->next;
    }
}

int main(void)
{
    ll n;
    scanf("%ld %ld",&n,&k);
    CombInit(k);
    Ginit(n);
    for(int i=0;i<n-1;i++)
    {
        ll a,b;
        scanf("%ld %ld",&a,&b);
        a--;b--;
        Gadd(a,b);
        Gadd(b,a);
    }
    ans = k;
    dfs(0,1,0);
    printf("%ld\n",ans);

    return 0;
}


Measured memory_bytes: 11136
#include "bits/stdc++.h"
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
using ll = long long;
using namespace std;

/*
ll GCD(ll a, ll b) {
	return b ? GCD(b, a%b) : a;
}

sort(a, a + N, greater<int>())   // descend
sort(a, a+N)                    //  ascend


** nCk
void comb(vector<vector <long long int > > &v) {
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}


** main内でnCn~nC0 生成 **
vector<vector<long long int> > v(n + 1, vector<long long int>(n + 1, 0));
	comb(v);


*/

int main() {
	ll n, m;
	cin >> n >> m;
	cout << (1800 * m + 100 * n)*pow(2, m);
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>

using namespace std;



int main(){

	int r;
	cin >> r;

	if(r < 1200){
		cout << "ABC" << endl;
	}else if(r < 2800){
		cout << "ARC" << endl;
	}else{
		cout << "AGC" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,m,ans,cnt[200010],parent[200010],level[200010];
int find(int x)
{
    if(x==parent[x])
    {
        return x;
    }
    return parent[x]=find(parent[x]);
}
void merge(int x,int y)
{
    x=find(x);
    y=find(y);
    if(x==y)
    {
        return;
    }
    if(level[x]>level[y])
    {
        swap(x,y);
    }
    parent[x]=y;
    if(level[x]==level[y])
    {
        level[y]++;
    }

}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
    {
        parent[i]=i;
        level[i]=1;
    }
    for(int i=0;i<m;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        merge(x,y);
    }
    for(int i=1;i<=n;i++)
    {
        cnt[find(i)]++;
    }
    for(int i=1;i<=n;i++)
    {
        ans=max(ans,cnt[i]);
    }
    printf("%d",ans);
}


Measured memory_bytes: 6048
a,b,k = map(int,input().split())
for i in range(k):
    if i % 2 == 0:
        if a %  2 == 1:
            a -= 1
        a = a // 2
        b += a
    else:
        if b % 2 == 1:
            b = b - 1
        b = b // 2
        a += b
            
print(a,b)

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

MOD = 10 ** 9 + 7

def gcd(x, y):
  return x if y == 0 else gcd(y, x % y)

def lcm(x, y):
  return x * y // gcd(x, y)

tmp = A[0]
for i in range(1, N):
  tmp = lcm(A[i], tmp)
#print(tmp)

answer = 0
for a in A:
  answer += tmp // a
print(answer % MOD)

Measured memory_bytes: 4084
#include <stdio.h>
 
int main(){
    int i, j, k;
    int n, x, s;
     
    while(scanf("%d %d", &n, &x), n > 0){
        s = 0;
         
        for(i = 1; i <= n; ++i){
            for(j = i + 1; j <= n; ++j){
                for(k = j + 1; k <= n; ++k){
                    if(i + j + k == x){
                        ++s;
                    }
                }
            }
        }
         
        printf("%d\n", s);
    }
     
    return 0;
}


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

int D[101]; 
int edges[101][101];

void bfs(int src,int n)
{
	queue<int> Q;
	Q.push(src);
	D[src]=0;
	while(!Q.empty())
	{
		int cur=Q.front();
		Q.pop();
		for(int dst=1;dst<=n;dst++)
		{
			int flag=0;
			for(int i=0;i<n;i++)
			{
				if(edges[cur][i]==dst)
				{
					flag=1;
					break;
				}
			}
			if(D[dst]==-1&&flag)
			{
				D[dst]=D[cur]+1;
				Q.push(dst);
			}
		}
	}
}

int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++)
	{
		int u,k;
		cin >> u >> k;
		for(int j=0;j<k;j++)
		   cin >> edges[u][j];
	}
	for(int i=1;i<=n;i++)
	   D[i]=-1;
	bfs(1,n);
	for(int i=1;i<=n;i++)
	   cout << i << ' ' << D[i] << endl;
}


Measured memory_bytes: 3128
//#define anjn
//      Anjan Agarwala - anjn98

//#define opti
#ifdef opti
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#endif

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, 
                  tree_order_statistics_node_update> ordered_set;

//ll power(ll x,ll y,ll p){ll r=1; x=x%p; while(y){ if(y&1) r= r*x%p; y=y>>1; x=x*x%p; } return r; }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int csrand(int l=0, int r=1e9){
  uniform_int_distribution<int> uid(l, r);
  return uid(rng);
}

#define PR(x) cout<<#x<<": "<<x<<"\n";
#define PR1(x,y) cout<<#x<<": "<<x<<"  |  "<<#y<<": "<<y<<"\n";
#define PR2(x,y,z) cout<<#x<<": "<<x<<"  |  "<<#y<<": "<<y<<"  |  "<<#z<<": "<<z<<"\n";
#define ED cout<<'\n';

#define IO              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define FILEIO          freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define all(v)          v.begin(),v.end()
#define endl            '\n'
#define fr1(j,n)        for(int j=0;j<n;j++)
#define fr(n)           for(int i=0;i<n;i++)
#define trav(x,s)       for(auto x:s)
#define PB              push_back
#define pii             pair<int,int>
#define pll             pair<long long int,long long int>
#define F               first
#define S               second 
#define binf            2000000000000000001
#define mod             1000000007

const int N=2e5+99; 



int32_t main() 
{
    IO


        

    ll n,a,b;
    cin>>n>>a>>b;

    n= n*a;

    cout<<min(n,b)<<endl;

        


}




 
    


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <cmath>
#include <algorithm>
using namespace std;
typedef pair<string, string> P;

int main(int argc, char *argv[])
{
  int n, k;
  cin >> n >> k;
  n--;k--;
  if(n%k==0){
    cout << n/k << endl;
  }else{
    cout << n/k+1 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) fpr(ll i=k;i<n;++i)
int main(void){
    ll r;
    cin>>r;
    cout<<fixed<<setprecision(10)<<2*3.141592*r<<endl;
}


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

typedef long long ll;

int32_t main() {
	ll n,m,k;
	cin >> n >> m >> k;
	vector<ll> A(n);
	ll ans2 = 0;
	for(ll i=0;i<n;i++) {
		cin >> A[i];
		if(i > 0) {
			A[i] += A[i-1];
		}
		if(A[i] <= k) {
			ans2 = max(ans2, i+1);
		}
	}
	vector<ll> B(m);
	for(ll i=0;i<m;i++) {
		cin >> B[i];
		if(i > 0) {
			B[i] += B[i-1];
		}
		if(B[i] <= k) {
			ans2 = max(ans2, i+1);
		}
	}
	for(ll i=0;i<n;i++) {
		ll l = 0, r = m-1;
		ll ans = -1;
		while(l <= r) {
			ll m = l + (r-l) / 2;
			if(B[m] + A[i] <= k) {
				ans = m;
				l = m + 1;
			} else {
				r = m - 1;
			}
		}
		if(ans != -1) {
			ans2 = max(ans2, i+1 + ans + 1);
		}
	}
	cout << ans2;
}

Measured memory_bytes: 6420
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

#define se second
#define fi first
#define ss size()
#define pb push_back
#define mp make_pair
#define ins insert
#define ll long long
#define y1 y12313312312
#define endl '\n'
#define gcd __gcd
#define tm tadsadaagsd
#define next nqweqweeqeqe
#define er erase
#define int ll

using namespace std;
//using namespace __gnu_pbds;

//template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int NN = 1e7 + 10, N = 3e5 + 40, T = 4 * N, logN = (int)log2(N) + 2, inf = 1e9 + 7, sx[4] = {1, -1, 0, 0}, sy[4] = {0, 0, 1, -1};

int n, m, r, l, e, o, z, ts, id, mx, mn = inf, w;
string s;
int f;

void freop()
{
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
}

void boos()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int bp (int x, int y) {
	if (y == 0) return 1;
	if (y % 2 == 1) return bp(x, y - 1) * x;
	else
    {
		int asd = bp(x, y / 2);
		return asd * asd;
	}
}

main()
{
    int x, y;
    setprecision(9);
    //freop();
    boos();
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5]) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		if (r<1200) System.out.println("ABC");
		else if (r<2800) System.out.println("ARC");
		else System.out.println("AGC");
	}
}

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

const int MOD = 998244353;

void solve_test() {
	int n, q;
	cin >> n >> q;

	vector<array<int, 2>> Q(q);
	for (int i = 0; i < q; i++)
		cin >> Q[i][0] >> Q[i][1];

	vector<array<int, 2>> Q_horizontal;
	vector<array<int, 2>> Q_vertical;
	for (int i = 0; i < q; i++) {
		int type = Q[i][0];
		int x = Q[i][1];

		if (type == 1)
			Q_horizontal.push_back({x, i});
		else
			Q_vertical.push_back({x, i});
	}
	sort(Q_horizontal.begin(), Q_horizontal.end());
	sort(Q_vertical.begin(), Q_vertical.end());

	LL blacks = (LL) (n - 2) * (n - 2);

	int w = n, h = n;
	vector<bool> marked(q);
	for (int i = 0; i < q; i++) {
		if (marked[i]) continue;

		marked[i] = true;

		int type = Q[i][0];
		int x = Q[i][1];

		if (type == 1) {
			blacks -= h - 2;
			while (!Q_horizontal.empty()) {
				int y = Q_horizontal.back()[0];
				int id = Q_horizontal.back()[1];
				if (y <= x)
					break;
				Q_horizontal.pop_back();

				if (marked[id])
					continue;

				blacks -= h - 2;
				marked[id] = true;
			}

			w = x;
		} else {
			blacks -= w - 2;
			while (!Q_vertical.empty()) {
				int y = Q_vertical.back()[0];
				int id = Q_vertical.back()[1];
				if (y <= x)
					break;
				Q_vertical.pop_back();

				if (marked[id])
					continue;

				blacks -= w - 2;
				marked[id] = true;
			}

			h = x;
		}
	}

	cout << blacks << '\n';
}

int main() {
	int T;
	T = 1;
	for (int t = 1; t <= T; t++)
		solve_test();

	return 0;
}


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

int main(){
  int x;
  cin >> x;
  x /= 100;
  if (x <= 5) {
    cout << 8 << endl;
  } else if (x <= 7) {
    cout << 7 << endl;
  } else if (x <= 9) {
    cout << 6 << endl;
  } else if (x <= 11) {
    cout << 5 << endl;
  } else if (x <= 13) {
    cout << 4 << endl;
  } else if (x <= 15) {
    cout << 3 << endl;
  } else if (x <= 17) {
    cout << 2 << endl;
  } else{
    cout << 1 << endl;
  }
  
}

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

#define MAX_M 100010
#define MAX_N 100010

int main(){
    int N,M; cin >> N >> M;

    int sum[MAX_N]={};
    bool is_ans[MAX_N]={};
    for(int i=1; i<MAX_N; i++){
	sum[i]=1;
	is_ans[i] = false;
    }

    int ans = 0;
    set<int> red;
    red.insert(1); is_ans[1] = true;
    for(int i=0; i<M; i++){
	int x,y;
	scanf("%d %d",&x,&y);

	if( red.find(x) != red.end() ){ // 候補にある
	    red.insert(y);
	    is_ans[y] = true;
	}
	sum[x]--;
	sum[y]++;
	if( sum[x] == 0 and red.find(x) != red.end() ){
	    red.erase(x);
	    is_ans[x] = false;
	}
    }

    for(int i=1; i<=N; i++){
	ans += (sum[i]>0 and is_ans[i]) ? 1 : 0;
    }
    cout << ans << endl;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
  int n;
  cin >> n;
  int n2 = 1<<n;
  vector<int> a(n2);
  rep(i,n2) cin >> a[i];
  sort(a.begin(), a.end());
  vector<int> s;
  s.push_back(a.back());
  a.back() = -1;
  rep(i,n) {
    vector<int> p = s;
    sort(p.begin(),p.end());
    int ai = n2-1;
    while (p.size() > 0 && ai >= 0) {
      if (a[ai] == -1) {
        --ai;
        continue;
      }
      if (a[ai] < p.back()) {
        s.push_back(a[ai]);
        p.pop_back();
        a[ai] = -1;
      }
      --ai;
    }
    if (p.size() > 0) {
      puts("No");
      return 0;
    }
  }
  puts("Yes");
  return 0;
}

Measured memory_bytes: 2932
N, M = map(int, input().split())
if N < M:
  print('No')
else:
  A = [input() for _ in range(N)]
  B = ''
  cnt = 0
  for _ in range(M):
    B += input().rstrip()
  for i in range(N-M+1):
    if cnt==1:
      break
    for j in range(N-M+1):
      judge = ''
      for k in range(M):
        judge += A[i+k][j:j+M]
      if judge == B:
        cnt += 1
        break
  if cnt == 1:
    print('Yes')
  else:
    print('No')

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

#define fi first
#define se second
#define pb push_back
#define mod(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,a,b) for(int i = a; i < b; i++)
#define forr(i,a,b) for(int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll N; cin >> N;
	ll res = N/1000;
	if(N%1000)res++;
	res *= 1000;
	cout << res-N << '\n';
	return 0;
}
/*
__builtin_mul_overflow(x,y,&x)
-fsplit-stack
*/


Measured memory_bytes: 3656
#include <iostream>
#include <vector>

using namespace std;

using int_t = int64_t;
struct edge_t {
    int_t to, len;
    edge_t(int_t t, int_t l) : to(t), len(l) {}
};


void dfs(const vector<vector<edge_t>>& E, vector<int>& color, int s, int c) {
    color[s] = c;

    for (auto& next : E[s]) {
        if (color[next.to] != -1) continue;

        dfs(E, color, next.to, (next.len % 2 == 0) ? c : !c);
    }
}


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

    vector<vector<edge_t>> E(N);
    vector<int> color(N, -1);

    for (int i = 0; i < N-1; i++) {
        int_t from; cin >> from;
        int_t to; cin >> to;
        int_t len; cin >> len;

        from--, to--;

        E[from].emplace_back(to, len);
        E[to].emplace_back(from, len);
    }

    for (int i = 0; i < N; i++) {
        if (color[i] == -1) {
            dfs(E, color, i, 0);
        }
    }

    for (auto c : color) {
        cout << c << endl;
    }

    return 0;
}


Measured memory_bytes: 9600