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

namespace ABC132
{
    class D
    {
        static void Main(string[] args)
        {
            long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long N = input[0];
            long K = input[1];

            init(4005);

            long red = 0;
            long blue = 0;
            for (long i = 1; i <= K; i++)
            {
                if (N - K + 1 < i) red = 0;
                else red = CalcCombination(N - K + 1, i);

                blue = CalcCombination(K - 1, i - 1);

                Console.WriteLine((blue * red) % 1000000007);

            }

        }

        // Combination
        static long[,] c;
        public static long[,] init(long x)
        {
            c = new long[x + 5, x + 5];
            c[0, 0] = 1;
            for (long i = 1; i <= x; i++)
            {
                for (long j = 0; j <= i; j++)
                {
                    if (j == 0) c[i, j] = c[i - 1, j];
                    else c[i, j] = (c[i - 1, j] + c[i - 1, j - 1]) % 1000000007;
                }
            }
            return c;
        }

        public static long CalcCombination(long n, long k)
        {
            return c[n, k];
        }

    }



}


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

long long read(){
    long long ret=0,f=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')f=-f;ch=getchar();}
    while(ch>='0'&&ch<='9') ret=ret*10+ch-'0',ch=getchar();
    return ret*f;
}
int n;
signed main(){
    //ios::sync_with_stdio(false);
    n=read();
    int ans=n*n*3;
    cout<<ans<<endl; 
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
  cin>>a>>b>>c;
  set<int>S;
  S.insert(a);
  S.insert(b);
  S.insert(c);
  int ans=S.size();
  cout<<ans<<endl;
  
  
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main(){
    int a;
    cin>>a;
    int arr[a], dp[a];
    for (int i=0; i<a; i++) cin>>arr[i], dp[i]=1e9;
    dp[0]=0, dp[1]=abs(arr[0]-arr[1]);
    for (int i=2; i<a; i++){
        dp[i]=min(dp[i], min(dp[i-1]+abs(arr[i]-arr[i-1]), dp[i-2]+abs(arr[i]-arr[i-2])));
    }
    cout<<dp[a-1]<<endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
	int   n;
	cin>>n;
	int m=n;
	int sum=0;
	
	do
	{
		sum+=n%10;
		
		n/=10;
}while(n>0);

	
	
	if(m%sum==0)
	{
		cout<<"Yes"<<endl;
		return 0;
	}
	else
	{
		cout<<"No"<<endl;
			return 0;
	}

	
	}

Measured memory_bytes: 256
#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 = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
random_device rnd;
mt19937 mt(rnd());
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1000000007;

bool ok(VL &v, ll l, int k)
{
    for (auto &x : v)
    {

        k -= (x + l - 1) / l - 1;
    }
    return k >= 0;
}

int main()
{
    int n, k;
    cin >> n >> k;
    VL v(n);
    rep(i, n)
    {
        cin >> v[i];
    }
    ll high = INF;
    ll low = 0;
    while (low + 1 != high)
    {
        ll mid = (high + low) / 2;
        if (ok(v, mid, k))
        {
            high = mid;
        }
        else
        {
            low = mid;
        }
    }
    cout << high << endl;
    return 0;
}

Measured memory_bytes: 4844
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define all(v) v.begin(),v.end()
#define zeros(arr) memset(arr,0,sizeof(arr));
#define precise(num)  cout<<fixed; cout << std::setprecision(num)
#define nl cout<<"\n";
#define test int t;cin>>t;while(t--) 
const int maxx  = 3*1e5 , limit = 1e17 , MOD=1e9+7;
#define boost  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int32_t main(){
    boost;
    string s;
    cin>>s;
    if(s[0] =='7'||s[1] =='7'||s[2] =='7'){
        cout<<"Yes\n";
    }else
    cout<<"No\n";
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t K;
  cin >> K;
  int64_t N = 7;
  int MAX = 1e6+10;
  for(int i=0; i<MAX; i++){
    if(N %K == 0){
      cout << i+1 << endl;
      return 0;
    }
    else{
      N *= 10;
      N += 7;
      N %= K;
    }
  }
  cout << -1 << endl;
}



Measured memory_bytes: 3632
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <time.h>
#define ll long long
#define ull unsigned long long
#define rep( i, a, n ) for( int i = a; i < n; i++ )
#define per( i, a, n ) for( int i = n - 1; i >= a; i-- )
#define mem( f, x ) memset( f, x, sizeof( f ) )
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define MOD 9901
#define INF 0x3f3f3f3f
#define e 2.71828
using namespace std;
const int N = 50000;
const int M = 4000;
const int MAX = 65537;
const ull inv = 500000004;
const double g = 9.80;
const double PI = acos( -1.0 );
int cnt;
ll su[M];

/*void init( ){
    cnt = 1;
    mem( vis, 1 );
    vis[0] = vis[1] = 0;
    for( ll i = 2; i < N; i++ ){
        if( vis[i] ){
            su[cnt++] = i;
            for( ll j = i*i; j < N; j += i )
                vis[j] = 0;
        }
    }
    cout << "cnt: " << cnt << endl;
}*/


int main(){
    //init();
    ll n, m;
    while( scanf( "%lld %lld", &n, &m ) != EOF ){
        if( n == 1 ){
            printf( "%lld\n", m );
            continue;
        }
        if( m == 1 ){
            printf( "1\n" );
            continue;
        }
        cnt = 1;
        for( ll i = 2; i*i <= m; i++ ){
            if( m%i == 0 ){
                su[cnt++] = i;
                su[cnt++] = m/i;
            }
        }
        su[cnt++] = m;
        sort( su, su + cnt );
        for( ll i = 1; i < cnt; i++ ){
            if( n > su[i-1] && n <= su[i] ){
                printf( "%lld\n", m/su[i] );
                break;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a[1000000],f[1000000];
int main()
{ cin>>n;
  for(int i=1;i<=n;i++)
    cin>>a[i];
    f[1]=0;
    f[2]=abs(a[1]-a[2]);
  for(int i=3;i<=n;i++)
    f[i]=min(abs(a[i-1]-a[i])+f[i-1],abs(a[i-2]-a[i])+f[i-2]);
  cout<<f[n];

}


Measured memory_bytes: 4736
//raja1999
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16)a; cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 <<endl;prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);
ll a[200005],cnt[25];
int main(){
	std::ios::sync_with_stdio(false);
	ll n,i,ans=0,fl=0,l,j;
	cin>>n;
	rep(i,n){
		cin>>a[i];
	}	
	l=0;
	rep(i,n){
		fl=0;
		rep(j,21){
			if(a[i]&(1<<j)){
				cnt[j]++;
				if(cnt[j]>=2){
					fl=1;
				}
			}

		}
		if(fl==0){
			ans+=i-l+1;
		}
		if(fl==1){
			//cout<<i<<" "<<l<<endl;
			//ans+=(i-1-l+2)*(i-1-l+1)/2;
			//cout<<ans<<endl;
			while(l<n){
				fl=0;
				rep(j,20){
					if(a[l]&(1<<j)){
						cnt[j]--;
						if(cnt[j]>=2){
							fl=1;
						}
					}
					else{
						if(cnt[j]>=2){
							fl=1;
						}
					}
				}
				if(fl==0){
					break;
				}
				l++;
			}
			l++;
			//cout<<i<<" "<<l<<" "<<fl<<endl;
			//rep(j,5){
			//	cout<<cnt[j]<<" ";
//
			//cout<<endl;
			ans+=i-l+1;
		}
	}
	cout<<ans<<endl;
} 
	

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const ll MOD = (ll) (1e9 + 7);
//const ll MOD = 998244353;
const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << setiosflags(ios::fixed);
    string s;
    cin >> s;
    int n = (int) s.length();
    ll dp[100010][13] = {};
    dp[0][0] = 1;
    ll pow10 = 1;
    int i = 1;

    for (auto itr = s.rbegin(); itr != s.rend(); itr++) {
        if (*itr == '?') {

            rep(di, 10) {

                rep(m, 13) {
                    dp[i][(m + pow10 * di) % 13] += dp[i - 1][m];
                    dp[i][(m + pow10 * di) % 13] %= MOD;
                }
            }

        } else {
            int num = (int) (*itr - '0');

            rep(m, 13) {
                dp[i][(m + pow10 * num) % 13] += dp[i - 1][m];
                dp[i][(m + pow10 * num) % 13] %= MOD;
            }
        }
        i++;
        pow10 = pow10 * 10 % 13;
    }
    cout << dp[n][5] << endl;
    return 0;
}



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

int main(){
    int n,sum=0,ans=INT_MAX;
    int su=0;
    cin >> n ;
    vector<int> l(n);
    for(int i=0;i<n;i++){
        cin >> l.at(i);
    }
    for(int i=1;i<n;i++){
        sum=0;
        su=0;
        for(int k=0;k<i;k++){
            sum+=l.at(k);
        }
        for(int k=i;k<n;k++){
            su+=l.at(k);
        }
        if(max(su,sum)-min(su,sum)<ans){
            ans=max(su,sum)-min(su,sum);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include <cstring>
using namespace std;
bool a[26];
int main() {
	char s[30];
	cin >> s;
	int len = strlen(s);
	for (int i = 0; i < len; ++i) {
		int t = s[i] - 'a';
		a[t] = true;
	}
	if (len != 26) {
		cout << s;
		for (int i = 0; i < 26; ++i) {
			if (!a[i]) {
				printf("%c", i + 'a');
				break;
			}
		}
		return 0;
	}
	bool f = false;
	for (int i = len - 1; i >= 0; --i) {
		for (int j = s[i] - 'a' + 1; j < 26; ++j) {
			if (!a[j]) {
				f = true;
				s[i] = '\0';
				cout << s;
				printf("%c", j + 'a');
				break;
			}
		}
		if (f) {
			break;
		}
		a[s[i] - 'a'] = false;
		s[i] = '\0';
	}
	if (!f) {
		cout << -1 << endl;
	}
	//system("pause");
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    while(1){
        int N;
        string card;
        cin>>N;
        if(N==0)break;
        else{
            cin>>card;
            int user[11]={0},ba=0;
            for(int i=0;i<100;i++){
                if(card[i]=='M')user[i%N]++;
                else if(card[i]=='S')ba+=user[i%N]+1,user[i%N]=0;
                else if(card[i]=='L')user[i%N]+=ba+1,ba=0;
            }
            sort(user,user+N);
            for(int i=0;i<N;i++)cout<<user[i]<<' ';
            cout<<ba<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF 2 << 29
#define MOD 1000000007
#define Yes(f) puts((f)? "Yes" : "No")
#define YES(f) puts((f)? "YES" : "NO")
#define pi 3.1415926535897
int gcd(int a, int b) {
	if (b != 0) return gcd(b, a % b);
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

using Graph = vector<vector<int>>;

int main(){
	int n; cin >> n;
	 cout << (1000 - (n % 1000)) % 1000 << endl;
}

Measured memory_bytes: 3644
import java.util.Scanner;

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

    double a = scanner.nextInt();
    double b = scanner.nextInt();
    double x = scanner.nextInt();

    double t;
    if (x > a * a * b * 0.5) {
      t = Math.atan2(a * a * a, 2 * a * a * b - 2 * x);
    } else {
      t = Math.atan2(2 * x, a * b * b);
    }
    System.out.println(90 - t * 180 / Math.PI);
  }
}


Measured memory_bytes: 22228
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cstdio>
#define LL long long
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
int ans;
int cnt(int x){
	int ret=0;
	while(x){
		ret++;
		x/=10;
	}
	return ret;
}
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		if(cnt(i)%2)ans++;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m,p;
	while(cin>>n>>m>>p,n){
	int cnt=0;
	int t;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		cnt+=x;
		if(i+1==m)t=x;
	}
	if(t==0)cout<<t<<endl;
	else cout<<cnt*(100-p)/t<<endl;
}
	return 0;
}
	



Measured memory_bytes: 3012
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>
#include <iomanip>

using namespace std;


int dp[10][10];




void doit(int n) {
	for (int i = n; i > 0; i--) {
		if (i < 10) {
			dp[i][i]++;
		}
		else {
			int last = i % 10;
			int x = i;
			while (x >= 10) {
				x /= 10;
			}
			//cout << x << " " << last << endl;
			dp[x][last]++;
		}
	}
	
}
int main() {

	int n;cin>>n;
	memset(dp, 0, sizeof dp);
	int ans = 0;
	doit(n);
	for (int i = 1; i <= 9; i++) {
		for (int j = 1; j <= 9; j++) {
			ans += dp[i][j] * dp[j][i] ;
		}
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

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

template<typename T>
constexpr T inf = static_cast<T>(pow(10, static_cast<int>(log10(numeric_limits<T>::max())))) + 7;
constexpr llong mod = 1e9+7;

int main() {
  string s;

  cin >> s;
  for (int i = 0; s[i]; ++i) {
    if (s[i] == '?') {
      s[i] = 'D';
    }
  }

  cout << s << endl;

  return 0;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n; cin>>n;
    ll sum = 0;
    vector<ll> a(n);
    rep(i,n){
        ll A; cin>>A;
        a[i]=A;
        sum^=A;
    }
    for(ll A:a){
        cout<<(sum^A)<<" ";
    }
    return 0;
}

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

int main() {
    /* Input */
    int K;
    string S;
    cin >> K;
    cin >> S;
   
    /* Main Logic */
    if ((int)S.size() <= K) {
        cout << S << endl;
        return 0;
    } else {
        cout << S.substr(0, K) + "..." << endl;
        return 0;
    }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define INF 0x7fffffff
#define LL_INF 0x7fffffffffffffff
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

ll gcd(ll a, ll b) {
	// a >= b
	while(b!=0) {
		ll r = a%b;
		a = b;
		b = r;
	}
	return a;
}

ll power(ll a, ll n) {
	ll res = 1;
	while(n > 0) {
		if(n & 1) {
			res *= a;
		}
		a *= a;
		n >>= 1;
	}
	return res;
}


vector<pair<int, int>> primeFactorization(int n)
{
	// (소인수, 지수)
	vector<pair<int, int>> primes;
	for(ll i=2;i<=sqrt(n);i++) {
		if(n%i==0) {
			int cnt = 0;
			while(n%i==0) {
				n/=i;
				cnt++;
			}
			primes.push_back(make_pair(i, cnt));
		}
	}
	if(n!=1)
		primes.push_back(make_pair(n, 1));
	return primes;
}


int main(void)
{
	int n;
	cin >> n;
	if(n==1) {
		cout << 1 << endl;
		return 0;
	}
	if(n%5==0 || n%2==0) {
		cout <<-1 << endl;
		return 0;
	}
	vector<pii> p = primeFactorization(n);
	vector<int> pp;
	for(auto pa : p) {
		if(pa.first == 7) {
			pa.second--;
			if(pa.second == 0) continue;
		}
		if(pa.first == 3) {
			pp.pb(power(pa.first, pa.second));
		}
		ll ten = 10;
		ll pm = power(pa.first, pa.second);
		ll n = 1;
		while(ten % pm != 1) {
			n++;
			ten = (ten * 10) % pm;
		}
		pp.pb(n);
	}
	if(pp.size() == 0) {
		cout << 1 << endl;
		return 0;
	}

	ll ans = pp[0];
	for(int i=0;i<pp.size();i++) {
		ll g = gcd(ans, pp[i]);
		ans = ans * pp[i] / g;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3680
//おまじない
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#define INF 1e9+7
#define rep(i,m,n) for(int i=m;i<n;i++)
#define mrep(i,m,n) for(int i=m;i>n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない



int main() {

	int N, T, A;
	int H[100000] = { 0 };
	cin >> N >> T >> A;
	rep(i, 0, N) {
		cin >> H[i];
	}

	int ans;
	int ST = INF;

	rep(i, 0, N) {
		int Nt = 1000*T - 1000*0.006*H[i];
		if (ST > abs(1000*A-Nt)) {
			ST = abs(1000*A - Nt);
			ans = i + 1;
		}
	}
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
int main()
{
    int n,m; cin>>n>>m;
    char a[n][m];
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            cin>>a[i][j];
        }
    }
    int dp[n][m];
    bool flag1=true,flag2=true;
    for(int i=0;i<n;i++)
    {
        if(a[i][0]=='#') flag1=false;
        if(flag1) dp[i][0]=1;
        else dp[i][0]=0;
    }
    for(int i=1;i<m;i++)
    {
        if(a[0][i]=='#') flag2=false;
        if(flag2) dp[0][i]=1;
        else dp[0][i]=0;
    }
    for(int i=1;i<n;i++)
    {
        for(int j=1;j<m;j++)
        {
            if(a[i][j]=='#') dp[i][j]=0;
            else dp[i][j]=(dp[i-1][j]%mod+dp[i][j-1]%mod)%mod;
        }
    }
    // for(int i=0;i<n;i++)
    // {
    //     for(int j=0;j<m;j++)
    //     {
    //         cout<<dp[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }
    cout<<dp[n-1][m-1];
}

Measured memory_bytes: 5120
def main():
    from decimal import Decimal

    N, A, B = map(int, input().split())
    *v, = map(Decimal, input().split())

    v.sort(reverse=True)

    max_average = sum(v[:A]) / A

    tail = v[A - 1]
    contained = [0] * (N + 1)
    s = 0
    for i, x in enumerate(v, start=1):
        if x == tail:
            s += 1
        contained[i] = s

    def choose(n, a):
        x, y = 1, 1
        for i in range(a):
            x = x * (n - i)
            y = y * (i + 1)
        return x // y

    count = 0
    for k in range(A, B + 1):
        if (k > A) and (v[k - 1] != max_average): break
        count += choose(contained[-1], contained[k])

    print(max_average)
    print(count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 5076
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
    int n, l;
    cin >> n >> l;
    string str[100];
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        str[i] = s;
    }
    sort(str, str + n);
    for (int i = 0; i < n; ++i) {
        cout << str[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
int min=1000;
int max=1;
int n;
int x[100];
int i;
int a;
scanf("%d",&n);

for(i=0;i<n;i++){
scanf("%d",&x[i]);
if(min > x[i]){
min = x[i];
}
if(max < x[i]){
max = x[i];
}
}
a = max-min;
printf("%d",a);
return 0;
}

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

const ll MX = 1e18;

int main() {
    int n;
    cin >> n;
    ll ans = 1;
    bool ng = false;
    rep(i,n) {
        ll a;
        cin >> a;
        if (a == 0) {
            cout << 0 << endl;
            return 0;
        }
        if (ng || MX/ans < a) {
            ng = true;
        }
        ans *= a;
    }
    if (ng) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3580
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <functional>

#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define REP(i,n) for(int i = 0; i < int(n); i++)

using namespace std;
using ll = long long;

int main() {
	string S;
	cin >> S;
	string A,B,C,D;
	A = S[0];
	B = S[1];
	C = S[2];
	D = S[3];
    int a = stoi(A);
	int b = stoi(B);
	int c = stoi(C);
	int d = stoi(D);
	if (a + b + c + d == 7) {
		cout << a << "+" << b << "+" << c << "+" << d << "=" << 7 << endl;
		return 0;
	}
	if (a + b + c - d == 7) {
		cout << a << "+" << b << "+" << c << "-" << d << "=" << 7 << endl;
		return 0;
	}
	if (a + b - c + d == 7) {
		cout << a << "+" << b << "-" << c << "+" << d << "=" << 7 << endl;
		return 0;
	}
	if (a - b + c + d == 7) {
		cout << a << "-" << b << "+" << c << "+" << d << "=" << 7 << endl;
		return 0;
	}
	if (a + b - c - d == 7) {
		cout << a << "+" << b << "-" << c << "-" << d << "=" << 7 << endl;
		return 0;
	}
	if (a - b + c - d == 7) {
		cout << a << "-" << b << "+" << c << "-" << d << "=" << 7 << endl;
		return 0;
	}
	if (a - b - c + d == 7) {
		cout << a << "-" << b << "-" << c << "+" << d << "=" << 7 << endl;
		return 0;
	}
	if (a - b - c - d == 7) {
		cout << a << "-" << b << "-" << c << "-" << d << "=" << 7 << endl;
		return 0;
	}

	return 0;
}

Measured memory_bytes: 256
n = int(input())
l = [int(i) for i in input().split()]


num = 10**9 + 1
boolean = True
for i in l[::-1]:
    if i <= num:
        num = i
    elif i-1 == num:
        num = i-1
    else:
        print('No')
        boolean = False
        break
    
if boolean:
    print('Yes')          


Measured memory_bytes: 14396
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
alias route = Tuple!(long, "From", long, "To");
long bignum = 1_000_000_007;

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    auto n = lread();
    auto march = new long[](5);
    long ans;
    foreach (_; 0 .. n)
    {
        auto s = sread();
        auto head = s[0];
        switch (head)
        {
        case 'M':
            march[0]++;
            break;
        case 'A':
            march[1]++;
            break;
        case 'R':
            march[2]++;
            break;
        case 'C':
            march[3]++;
            break;
        case 'H':
            march[4]++;
            break;
        default:
            break;
        }
    }
    foreach (i; 0 .. (1 << 5))
    {
        long tmp = 1;
        if (i.popcnt == 3)
        {
            foreach (j; 0 .. march.length)
            {
                if(i & (1 << j))
                    tmp *= march[j];
            }
            ans += tmp;
        }
    }
    ans.writeln();
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1e9,MOD=998244353;

int main(){
	int k; cin>>k;
	int gu=k/2;
	int ki=k/2+k%2;
	cout<<gu*ki<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
using namespace std;
int main(){
    int n;
    int a[1000];
    while(cin >> n){
        for(int i = 0; i < n; i++){
            cin >> a[i];
        }
        int minn = 0x3f3f3f3f;
        for(int j = -100; j <= 100; j++){
            int ans = 0;
            for(int i = 0; i < n; i++){
                ans += pow((a[i] + j), 2);
            }
            minn = min(minn, ans);
        }
        printf("%d\n", minn);
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
using ll = long long;
int main() {
    char c;
    cin >> c;
    if(isupper(c)){
        cout << 'A' << endl;
    }else{
        cout << 'a' << endl;
    }
    return 0;
}

Measured memory_bytes: 3612
N,M=map(int,input().split())
s=[]
c=[]
for i in range(M):
    a, b = map(int,input().split())
    s.append(a)
    c.append(b)

okflag = True

for i in range(M):

    if not okflag:
         break
    for j in range(M):
     if not okflag:
         break
     if not (i==j):
        if s[i]==s[j] and c[i]!=c[j]:
            okflag = False
            print("-1")
if okflag:
    answer = ["x"] * N

    for i in range(M):
        answer[s[i]-1] = str(c[i])
    
    if N == 1 and answer[0] == "x":
        print("0")
    elif N == 1 and not answer[0] == "x":
        print(answer[0])

    elif not N == 1 and answer[0] == "0":
        print("-1")
    
    elif not N == 1:
        for i in range(N):
            if answer[i] == "x":
                if i == 0:
                    answer[i] = "1"
                else:
                    answer[i] = "0"
        result = ''.join(answer)
        print(result)
    


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define ALL(v) v.begin(),v.end()
typedef long long ll;
int main() {
  int n;
  cin >> n; 
  ll a=1000000007;
  ll ans=1; 
  for(int i=0; i<n; i++){
    ans*=(i+1);
    ans%=a;
  }
  cout << ans << endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  /*vector<int> vec2(N);*/
  float a = 0;
  int b = 0;
  
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
	a += vec.at(i);
  }
  a = a / N + 0.5;
  a = (int)a;
  for (int i = 0; i < N; i++) {
    vec.at(i) = pow(vec.at(i) - a, 2.0);
    b += vec.at(i);
  }
  cout << b;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;

ll mod_pow(ll x,ll n){
  if(n==0) return 1;
  ll ret=1;
  ret = mod_pow((x*x)%MOD,n/2);
  if(n&1) ret = ret*x%MOD;
  return ret;
}

template <ll mod>
struct ModCombination{
    ll N;
    vector<ll> fact,inv,finv;

    ModCombination(ll n):N(n){
        fact.assign(n+1, 1);
        inv.assign(n+1, 1);
        finv.assign(n+1,1);
        for(int i=1;i<n;i++){
            fact[i+1] = fact[i]*(i+1)%mod;
            inv[i+1] = inv[mod%(i+1)]*(mod-mod/(i+1))%mod;
            finv[i+1] = finv[i]*inv[i+1]%mod;
        }
    }

    ll Comb(ll n,ll k){
        return (fact[n]*finv[k]%mod)*finv[n-k]%mod;
    }
};

ll dp[1123][1123];
int main() {
  int N,A,B,C,D;
  cin >> N >> A >> B >> C >> D;
  ModCombination<MOD> comb(N);
  dp[A-1][0] = 1;
  for(int i=A;i<=B;i++){
    for(int j=0;j<=N;j++){
      dp[i][j] = dp[i-1][j];
      for(int k=C;k<=min(D,j/i);k++){
        ll c = (((((comb.Comb(N-j+i*k,i*k)*comb.fact[i*k])%MOD)*mod_pow(comb.finv[i],k))%MOD)*comb.finv[k])%MOD;
        dp[i][j] = (dp[i][j]+(c*dp[i-1][j-i*k])%MOD)%MOD;
      }
    }
  }
  cout << dp[B][N] << endl;
  return 0;
}


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

int main() {
  int H; cin >> H; // 縦の文字数
  int W; cin >> W; // 横の文字数
  vector<string> A(H); // 文字列。Ｈ個

  // 上枠
  cout << "#";
  rep(i,W){
    cout << "#";
  }
  cout << "#" << endl;
  
  
  rep(i,H){
    cin >> A.at(i);
    // 左端
    cout << "#" << A.at(i) << "#" << endl;
  }

  // 上枠
  cout << "#";
  rep(i,W){
    cout << "#";
  }
  cout << "#" << endl;

}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) {

        Integer[] input = readInput();
        int a = input[0];
        int b = input[1];
        int c = input[2];

        if (a < b && b < c) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }


    public static Integer[] readInput() {
        List<Integer> l = new ArrayList<Integer>();

        Scanner sc = new Scanner(System.in);
        while (sc.hasNextInt()) {
            l.add(sc.nextInt());
        }
        return l.toArray(new Integer[l.size()]);
    }
}

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

int main(void) {
  int N;
  cin >> N;
  double denominator = 0;
  for (int i = 0; i < N; i++) {
    double A;
    cin >> A;
    denominator += 1.0 / A;
  }
  cout << fixed << setprecision(5) << 1.0 / denominator << 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[][] first = new int[3][3];
		
		for (int r = 0; r < 3; r++) 
		{
			for (int c = 0; c < 3; c++) 
			{

				first[r][c] = sc.nextInt();
			}
		}
		int a[]= new int[101];
		int n=sc.nextInt();
		for(int i=0;i<n;i++)
		{
			int temp=sc.nextInt();
			a[temp]++;
		}
		if(a[first[0][0]]>0 && a[first[0][1]]>0 && a[first[0][2]]>0)
		{
			System.out.print("Yes");
		}
		else if(a[first[1][0]]>0 && a[first[1][1]]>0 && a[first[1][2]]>0)
		{
			System.out.print("Yes");
		}
		else if(a[first[2][0]]>0 && a[first[2][1]]>0 && a[first[2][2]]>0)
		{
			System.out.print("Yes");
		}
		else if(a[first[0][0]]>0 && a[first[1][0]]>0 && a[first[2][0]]>0)
		{
			System.out.print("Yes");
		}
		else if(a[first[0][1]]>0 && a[first[1][1]]>0 && a[first[2][1]]>0)
		{
			System.out.print("Yes");
		}
		else if(a[first[0][2]]>0 && a[first[1][2]]>0 && a[first[2][2]]>0)
		{
			System.out.print("Yes");
		}
		else if(a[first[0][0]]>0 && a[first[1][1]]>0 && a[first[2][2]]>0)
		{
			System.out.print("Yes");
		}
		
		else if(a[first[0][2]]>0 && a[first[1][1]]>0 && a[first[2][0]]>0)
		{
			System.out.print("Yes");
		}
		else
		{
			System.out.print("No");

		}
	}
}


Measured memory_bytes: 22868
#include<bits/stdc++.h>
using namespace std;
#define fp(i,l,r) for(register int (i)=(l);(i)<=(r);++(i))
#define fd(i,l,r) for(register int (i)=(l);(i)>=(r);--(i))
#define fe(i,u) for(register int (i)=front[(u)];(i);(i)=e[(i)].next)
#define O(x) cerr<<#x<<':'<<x<<endl
#define mem(a) memset((a),0,sizeof (a))
#define int long long
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
    return x*f;
}
void wr(int x){
    if(x<0)putchar('-'),x=-x;
    if(x>=10)wr(x/10);
	putchar('0'+x%10);
}
const int mod=998244353;
inline void rmod(int &x){x+=x>>31&mod;} 
inline void tmod(int &x){x%=mod;}
inline int qpow(int a,int b){
	int res=1;
	for(;b;b>>=1,tmod(a*=a))
	if(b&1)tmod(res*=a);
	return res;
}
inline int inv(int x){return qpow(x,mod-2);}
int g[405][405],tmp[405][405],n,a[405],b[405],fac[405],ifac[405];
main(){
	n=read();
	fp(i,1,n)a[i]=read(),b[i]=read()-1;
	g[0][0]=mod-1;
	fac[0]=1;fp(i,1,404)fac[i]=fac[i-1]*i%mod;
	ifac[404]=inv(fac[404]);fd(i,403,0)ifac[i]=ifac[i+1]*(i+1)%mod;
	int sa=0,sb=0;
	fp(i,1,n){
		fp(j,0,sa)fp(k,0,sb){
			int t=1;
			fp(l,0,b[i])
			tmod(tmp[j+a[i]][k+l]+=t*ifac[l]%mod*g[j][k]),t=t*a[i]%mod;
		} 
		sa+=a[i];sb+=b[i];
		fp(j,0,sa)fp(k,0,sb)
		rmod(g[j][k]-=tmp[j][k]),tmp[j][k]=0;
	}
	int ans=0;
	fp(i,1,sa){
		int t=inv(i),p=t*sa%mod;
		fp(j,0,sb)
		tmod(ans+=fac[j]*p%mod*g[i][j]),p=p*t%mod;
	}
	printf("%lld\n",ans);
	return 0;
} 

Measured memory_bytes: 2816
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ1
		int x;
		int y;
		int t;

	    Scanner sc = new Scanner(System.in);

		while(true) {
		    x = sc.nextInt();
		    y = sc.nextInt();

		    if(x == 0 && y == 0) break;

			if(x>y) {
				t = x;
				x = y;
				y = t;
			}
			System.out.printf(String.format("%d %d\n",x, y));
		}

	}

}



Measured memory_bytes: 41108
#include <stdio.h>
#include <ctype.h>
#include <string.h>

int main(void)
{
  char s[11];
  int len,i,c = 0;

  scanf("%s",s);

  len = strlen(s);

  if(s[0] != 'A')
    goto WA;

  for(i = 2; i < len-1; i ++)
    if(s[i] == 'C')
      c++;

  if(c != 1)
    goto WA;

  if(! islower(s[1]))
    goto WA;

  for(i = 2; i < len-1; i ++)
    if(!(islower(s[i]) || s[i] == 'C'))
      goto WA;

   if(! islower(s[len-1]))
    goto WA;

  printf("AC\n");
  return(0);

WA:
  printf("WA\n");
  return(0);
}


Measured memory_bytes: 128
program j01;
var s:ansistring;
    ans:array[0..100086]of longint;
    c:array[0..1]of char;
    flag:boolean;
    i,n:longint;

procedure check;
var i:longint;dd,dd2:longint;ch:longint;
begin
  dd:=ord(s[1]='o');
  if ((dd=1)and(ans[1]=0))or((dd=0)and(ans[1]=1)) then
    ch:=ans[2] else ch:=1-ans[2];
  for i:=2 to n-1 do
  begin
    dd:=ord(s[i]='o');
    if((dd=1)and(ans[i]=0))or((dd=0)and(ans[i]=1)) then
      ans[i+1]:=ans[i-1] else ans[i+1]:=1-ans[i-1];
  end;
  dd:=ord(s[n]='o');
  dd2:=ord(ans[n-1]=ans[1]);
  if((ans[n]=0)and(dd<>dd2))or((ans[n]=1)and(dd=dd2)) then exit; 
  if ch=ans[n] then
  begin
    for i:=1 to n do
      if ans[i]=0 then write('S') else write('W');
    halt;
  end;
end;

begin
  readln(n);readln(s);
  ans[1]:=0;ans[2]:=0;
  check;
  ans[1]:=0;ans[2]:=1;
  check;
  ans[1]:=1;ans[2]:=0;
  check;
  ans[1]:=1;ans[2]:=1;
  check;
  writeln(-1);
end.



Measured memory_bytes: 768
k = int(input())
L = [49]*50
t = k//50
for i in range(50):
    L[i] += t
m = k%50
for i in range(m):
    for j in range(50):
        if i == j:
            L[j] += 50
        else:
            L[j] -= 1
print(50)
print(' '.join(map(str, L)))


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


int main() {
    int n, m; cin >> n >> m;
    std::vector<int> a(m); 
    std::vector<string> b(m);
    std::vector<int> c(n,0); // ac出たかどうかを判定
    std::vector<int> d(n, 0); //WAしたかずをカウント
    
    if (m == 0) cout << 0 << " " << 0 << endl;
    else {
        for (int i = 0; i < m; i++) cin >> a[i] >> b[i];

        for (int i = 0; i < m; i++) {
            if (b[i] == "WA") {
                if (c[a[i]-1] == 0) {
                    d[a[i]-1] += 1;
                }
            }
            else if (b[i] == "AC") {
                c[a[i]-1] = 1;
            }
        }

        int solve = 0; int penalty = 0;
        for (int i = 0; i < n; i++) {
            if (c[i] == 1) {
                solve += 1;
                penalty += d[i];
            }
        }

        cout << solve << " " << penalty << endl;
    }
}

Measured memory_bytes: 6912
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 c = sc.nextInt();
		
		if(a <= c && c <= b) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
	}

}


Measured memory_bytes: 21460
fun main(args: Array<String>) {
    var (a,b,c) = readLine()!!.split(" ").map(String::toInt)
    var sum = a
    var flag = 0
    for(i in 1..1000000){
        if(sum%b == c) {
            flag = 1
            break
        }
        sum += a
    }
    if(flag==1) println("YES")
    else println("NO")
}


Measured memory_bytes: 36180
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>

using namespace std;

typedef pair<int , int> pii;
#define rep(i,a) for(int i = 0 ; i < a ; i ++)
const int INF = 1<<30;

int n ;
vector<int> way[120];

int mini(int s,int d,int v);

int main(void){
  cin>>n;
  rep(i,n){
    int r,k;
    cin>>r>>k;
    while(k--){
      int t;
      cin>>t;
      way[r].push_back(t);
    }
  }
  int p;
  cin>>p;
  
  while(p--){
    int s,d,v;
    cin>>s>>d>>v;
    int cost = mini(s,d,v);
    if(cost == INF) cout<< "NA" << endl;
    else cout<< cost << endl;
  }
  return 0;
  
  
}
int mini(int s, int d, int v)
{
    int diff[128];
    queue<pii> q;
     
    fill(diff, diff + n + 1, INF);
    q.push(pii(s, 1));
    diff[s] = 1;
    while (!q.empty()){
        pii p = q.front(); q.pop();
         
        if (diff[p.first] < p.second) continue;
        for (int i = 0; i < way[p.first].size(); i++){
            int tmp = way[p.first][i];
             
            if (diff[tmp] > diff[p.first] + 1){
                diff[tmp] = diff[p.first] + 1;
                q.push(pii(tmp, diff[tmp]));
            }
        }
    }
     
    if (diff[d] == INF || diff[d] > v) return INF;
    else return diff[d];
}

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

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split();
        var A = int.Parse(input[0]);    
        var B = int.Parse(input[1]);
        if (B <= 1)
        {
            Console.WriteLine(0);
            return;
        }

        var sum = 0;
        var ans = 0;
        while (true)
        {
            sum += A;
            ans++;
            if (sum >= B)
            {
                Console.WriteLine(ans);
                return;
            }
            sum--;
        }
    }
}


Measured memory_bytes: 13140
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<set>
//#include<boost/math/common_factor_rt.hpp>
#include <numeric>
using namespace std;

#define ll long long
#define INF 1000000007;
ll a[100050] = {}; 
int ans = 0;

int main() {
	int R, G, B, N;

	cin >> R >> G >> B >> N;
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= N; j++)
		{
			int tmp = N - R * i - G * j;
			if (tmp >= 0 && tmp % B == 0) {
				ans++;
			}
		}
	}
	

	cout << ans << endl;
}




Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int main()
{
	char s[7];
	int n;
	scanf("%s",s);
	if(s[0]=='S')	printf("Cloudy\n");
	if(s[0]=='C')	printf("Rainy\n");
	if(s[0]=='R')	printf("Sunny\n");
	return 0;
}

Measured memory_bytes: 128
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 1000000009
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	N := nextInt()
	M := nextInt()
	s := make([]int, M)
	c := make([]int, M)
	ans := -1
	for i := 0; i < M; i++ {
		s[i] = nextInt() - 1
		c[i] = nextInt()
	}
	// 計算量が多くないので総当りでチェックできる
	for i := 0; i < 1000; i++ {
		nums := strconv.Itoa(i)
		check := true
		// 桁数をまずはチェック。数値をstringに変換してlenで桁数が出せる
		if len(nums) == N {
			//  条件を一つずつ確認する。M=0の場合は何も行われないでそのままcheck == true
			for j := 0; j < M; j++ {
				// 確認中の数値がそれぞれの条件に一致するかをチェックする。
				num, _ := strconv.Atoi(string(nums[s[j]]))
				if num != c[j] {
					check = false
				}
			}
		} else {
			check = false
		}
		if check == true {
			ans = i
			fmt.Println(ans)
			return
		}
	}
	fmt.Println(ans)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 32128
#include <iostream>
#include <string>

#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
int main(){
    string s,t; cin>>s>>t;
    int cnt=0;
    rep(i,3){
        if(s[i]==t[i]) cnt++;
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
  string s;
  cin >> s;
  int a,b;
  rep(i,s.size()){
    if(s.at(i)=='A'){
      a=i;
      break;
    }
  }
  for(int i=s.size()-1;i>=0;i--){
    if(s.at(i)=='Z'){
      b=i;
      break;
    }
  }
  cout << b-a+1 << endl;
}

Measured memory_bytes: 640
import java.io.*;
public class Main{
  public static void main(String[] args){
    BufferedReader mBufferedReader=new BufferedReader(new InputStreamReader(System.in));
    try{
      int i=1;
      int x;
      String str;
      while((str=mBufferedReader.readLine())!=null){
        x=Integer.parseInt(str);
          if(x==0){
            break;
          }
            System.out.println("Case "+i+": "+str);
            i++;
          }
      mBufferedReader.close();
    }catch(IOException e){
      e.printStackTrace();
    }
  }
}


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

int n,k;

int main(){
	cin >> n >> k;

	int A[n];

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

	cout << (n-1+(k-2))/(k-1) << endl;

	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <queue>
#define INF 1e+9
using namespace std;

typedef pair<int,int> P;

int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};

int dist[1000][1000];
string field[1000];

int main(){
	int h,w,n,x,y,res = 0;
	cin >> h >> w >> n;
	for(int i = 0;i < h;i++){
		cin >> field[i];
		for(int j = 0;j < w;j++){
			if(field[i][j] == 'S'){
				x = i;
				y = j;
			}
		}
	}
	queue<P> que;
	for(int i = 0;i < n;i++){
		for(int j = 0;j < h;j++){
			for(int k = 0;k < w;k++) dist[j][k] = INF;
		}
		que.push(P(x,y));
		for(int d = 0;;d++){
			int siz = que.size();
			if(!siz) break;
			for(int j = 0;j < siz;j++){
				P p = que.front();que.pop();
				int nx = p.first,ny = p.second;
				if(dist[nx][ny] < d) continue;
				if(field[nx][ny] == i + 1 + '0'){
					x = nx;
					y = ny;
					res += dist[nx][ny];
				}
				for(int k = 0;k < 4;k++){
					int nnx = nx + dx[k],nny = ny + dy[k];
					if(nnx >= 0 && nnx < h && nny >= 0 && nny < w && field[nnx][nny] != 'X' && dist[nnx][nny] > d + 1){
						dist[nnx][nny] = d + 1;
						que.push(P(nnx,nny));
					}
				}
			}
		}
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 7836
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n, k;
    cin >> n >> k;
 
    vector<int> snuke(n, 1);
    for(int i=0; i<k; i++){
        int d;
        cin >> d;
        for(int j=0; j<d; j++){
            int a;
            cin >> a;
            a -= 1;
            snuke[a] = 0;
        }
    }
 
    int ans = 0;
    for(int i=0; i<n; i++){
        ans += snuke[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	cout << max(a*b ,c*d);
	return 0;
}

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

#define ll long long

int main() {
	ll n, m, k;
	cin >> n >> m >> k;
	ll i, j;
	ll s = 0;
	ll res;
	vector<ll> a(n+1);
	vector<ll> b(m+1);
	a[0] = 0; b[0] = 0;
	for (i = 1; i <= n; i++) {
		cin >> a[i];
		a[i] += a[i - 1];
	}
	for (i = 1; i <= m; i++) {
		cin >> b[i];
		b[i] += b[i - 1];
	}
	for (i = 1; i <= n; i++) {
		if (a[i] > k) {
			break;
		}
	}
	i--;
	res = i;
	for (j = i ; j >= 0; j--) {
		if (s >= m)break;
		while (a[j] + b[s] < k) {
			if (j + s > res)res = j + s;
			s++;
			if (s >= m)break;
		}
		if (j + s > res && a[j] + b[s] <= k)res = j + s;
		
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 6352
#include<bits/stdc++.h>
using namespace std;
int main(){
int A,B,C,K;
  cin>>A>>B>>C>>K;
  if(K<=A)
    cout<<K<<endl;
  else if(K<=A+B)
    cout<<A<<endl;
  else
    cout<<2*A-K+B<<endl;
    
    return 0;
}

Measured memory_bytes: 3580
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int main(){
    long long int N,sum=0;
    cin >> N;
    vector<long long int> A(N);
    for(int i=0;i<N;i++){
            cin >> A[i];
            if(i>0) sum+=abs(A[i-1]-A[i]);
            else    sum+=abs(A[i]);
    }
    sum+=abs(A[N-1]);

    for(int i=0;i<N;i++){
        if(i==0)    cout << sum - ( abs(A[i]) + abs(A[i]-A[i+1]) )+ abs(A[i+1])<<endl;
        else if(i==N-1)     cout << sum - ( abs(A[i-1]-A[i]) + abs(A[i]) ) + abs(A[i-1])<<endl;
        else    cout << sum - ( abs(A[i-1]-A[i])+abs(A[i]-A[i+1]) ) + abs(A[i-1]-A[i+1])<<endl;
    }
}

Measured memory_bytes: 2048
use std::io::Read;
use std::str::SplitWhitespace;
use std::str::FromStr;

pub fn read_stdin() -> String {
    let mut s = String::new();
    ::std::io::stdin().read_to_string(&mut s).unwrap();
    s
}

pub trait Parse<T> {
    fn parse(&mut self) -> T;
}

impl<'a, T> Parse<T> for SplitWhitespace<'a>
where
    T: FromStr,
{
    fn parse(&mut self) -> T {
        let word = self.next().unwrap();
        word.parse().ok().unwrap()
    }
}

fn main() {
    let source = read_stdin();
    let mut iter = source.split_whitespace();
    let yyyymmdd: String = iter.parse();
    let s = yyyymmdd
        .split('/')
        .map(|x| x.parse::<u32>().unwrap())
        .collect::<Vec<_>>();
    let is_tbd = s[0] >= 2019 && s[1] >= 5;

    println!("{}", if is_tbd { "TBD" } else { "Heisei" });
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int const nax = 3e5 + 10;
int n, k;
bool e[nax];

int main () {

    scanf("%d %d", &n, &k);

    for (int i = 1 ; i <= k; ++ i) {
        int x;
        scanf("%d", &x);

        while (x -- ) {
            int y;
            scanf("%d", &y);
            e[y] = true;
        }
    }

    int ans = 0;

    for (int i = 1 ; i <= n ; ++ i) {
        if (!e[i]) ++ ans;
    }

    cout << ans << endl;
}
/*
    Good Luck
        -Lucina
*/


Measured memory_bytes: 3768