akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long li;

int n;
char s[100];

int main(void) {
  scanf("%s", s);
  n = strlen(s);

  if (n < 26) {
    bool use[26] = {};
    for (int i = 0; i < n; ++i) {
      use[s[i] - 'a'] = true;
    }
    int first = -1;
    for (int i = 0; i < 26; ++i) {
      if (!use[i]) {
        first = i;
        break;
      }
    }
    s[n++] = first + 'a';
    s[n] = '\0';
    puts(s);
    return 0;
  }

  for (int m = n - 1; m >= 0; --m) {
    bool dec = true;
    for (int i = m; i + 1 < n; ++i) {
      if (s[i] < s[i + 1]) {
        dec = false;
        break;
      }
    }
    if (!dec) {
      bool use[26] = {};
      for (int i = m; i < n; ++i) {
        use[s[i] - 'a'] = true;
      }
      int next = -1;
      for (int i = s[m] - 'a' + 1; i < 26; ++i) {
        if (use[i]) {
          next = i;
          break;
        }
      }
      s[m] = 'a' + next;
      s[m + 1] = '\0';
      puts(s);
      return 0;
    }
  }
  puts("-1");
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC046A___AtCoDeerくんとペンキ
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            string[] boughtPaints = input.Split(' ');

            HashSet<string> paintType = new HashSet<string>();
            foreach(string boughtPaint in boughtPaints)
            {
                paintType.Add(boughtPaint);
            }

            Console.WriteLine(paintType.Count);
        }
    }
}


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

#define endl '\n'
#define ll long long

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);

    string s;
    cin >> s;
    ll sum = 0;
    for(auto &x : s) {
        sum += x - '0';
        sum %= 9;
    }
    sum == 0 ? cout << "Yes\n" : cout << "No\n";
}

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

ll arr[3000];
ll dp[3000][3000][2];
int n;
ll X=0,Y=0;

ll solve(int s, int e, int turn){
    
    if(s>e){
        return 0;//max(arr[s],arr[e]);
    }
    if(dp[s][e][turn]!=-1)
        return dp[s][e][turn];

    if(turn ==1 ){
        return dp[s][e][turn]=max(arr[s]+solve(s+1,e,0),arr[e]+solve(s,e-1,0));
    }else
    {
        return dp[s][e][turn]=min(solve(s+1,e,1),solve(s,e-1,1));
    }
}

int main()
{
    memset(dp,-1,sizeof(dp));
    cin>>n;
    ll sum=0;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        sum+=arr[i];
        //cout<<sum<<endl;
    }
    ll x=solve(0,n-1,1);
    cout<<x-(sum-x);
    return 0;
}

Measured memory_bytes: 144452
#include <stdio.h>
int LCM(int a,int b)
{
	int r,x,tmp;
	x=a*b;
	if(a<b){
		tmp=a;
		a=b;
		b=tmp;
	}
	r=a%b;
	while(r!=0){
		a=b;
		b=r;
		r=a%b;
	}
	return x/b;
}
int main(void)
{
	int a,b,c,d,i,j;
	scanf("%d%d%d",&a,&b,&c);
	d=LCM(a,b);
	for(i=1; i<=d/a; i++){
		for(j=0; j<=d/b; j++){
			if(a*i==b*j+c){
				printf("YES\n");
				return 0;
			}
		}
	}
	printf("NO\n");
	return 0;
}

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

int main() {
  string s;
  cin >> s ;

  int count = 0;
  
for( int i = 0 ; i < 3 ; i ++) {
 if (s[i] == '1')
    count++;
  
}
  cout << count << endl;
}

  




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


int main()
{
int k,n;
cin >> k >> n;
vector <int> a(n);
for (int i=0; i<n; i++) cin >> a[i];
long int index = 0, maxDiff = a[0] + k - a[n-1];
for (int i=0; i<n-1; i++)

        if (a[i+1]-a[i]>maxDiff)
            { maxDiff =a[i+1]-a[i];
                index = i+1;
            }



//cout << index;


long long int res=0;
for (int i=0; i<n-1; i++)
    {
            int a1,a2;
            if (i+1+index>=n) a1 = a[(i+1+index)%n]+k; else a1 = a[i+1+index];
            if (i+index>=n) a2 = a[(i+index)%n]+k; else a2 = a[i+index];
            res += a1-a2;
    }
cout << res;


}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<limits>
#include<iomanip>
#include<cmath>
#include<climits>

using namespace std;

#define f first 
#define s second 
#define mp make_pair
#define pb push_back

typedef long long ll;

const int mod=1e9+7;
const int INF=INT_MAX;

int n,m;
vector<int> k(20),p(20);
vector< vector<int> > s(20,vector<int>(20));
int onoff[20];
int ans=0;


void dfs(int depth){
    if(depth<n){
        
        onoff[depth]=0;
        dfs(depth+1);
        
        onoff[depth]=1;
        dfs(depth+1);
    
    }else if(depth==n){
    
        bool OK=true;
        for(int i=0;i<m;i++){
            int cnt=0;
            for(int j=0;j<k[i];j++){
                if(onoff[s[i][j]-1]==1){
                    cnt++;
                }
            }
            if(cnt%2==p[i]){
                ;
            }else{
                OK=false;
            }
        }
        if(OK){
            ans++;
        }
    }
}


int main(){
    cin >> n >> m;
    for(int i=0;i<m;i++){
        cin >> k[i];
        for(int j=0;j<k[i];j++){
            cin >> s[i][j];
        }
    }
    for(int i=0;i<m;i++){
        cin >> p[i];
    }
    dfs(0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2000000000;//10^9
ll MOD  = 1000000007;

int main(void){
    ll N,M;
    cin >> N >> M;
    
    ll ans = 0;
    for(ll i = 1; i * i <= M; i++){
        if(M % i == 0){
            ll a,b;
            a = i;
            b = M / i;
            if(a <= M / N){
                ans = max(ans, a);
            }
            if(b <= M / N){
                ans = max(ans, b);
            }
        }
    }
    
    cout << ans << endl;
}


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

using namespace std;


int main(){
    int n,m;
    cin >> n >> m;
    vector<bool>isvalid(n,true);
    for(int i = 0; i < m; ++i){
        int e; cin >> e;
        --e;
        isvalid[e] = false;
    }
    int MOD = 1000000007;
    vector<int>dp(n);
    dp[0] = isvalid[0];
    dp[1] = (isvalid[1] ? dp[0] + 1 : 0 );
    for(int i = 2; i < n; ++i){
        if(isvalid[i] == false)continue;
        dp[i] = dp[i-1] + dp[i-2];
        dp[i] %= MOD;
     }
    cout << dp.back() << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define mo 1000000007
#define mod2 1000000000
#define mod1 998244353
#define lol ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define F(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define ss second

int main()
{
    lol;
    ll n;cin >> n;
    string x;cin >> x;
    ll cnt1 = 0;
    ll cnt2 = 0;
    for(ll i=0;i<n;i++)
    {
        if(x[i]=='W') cnt1++;
        else cnt2++;
    }
    ll ans = min(cnt1,cnt2);
    ll c = 0;
    for(ll i=0;i<cnt2;i++)
    {
        if(x[i]=='W') c++;
    }
    ans = min(ans,c);
    cout << ans << endl;
}

Measured memory_bytes: 3708
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<math.h>
#include<numeric>
#include<cassert>
#include<random>
#include<deque>
#include<chrono>
#include<unordered_map>
#include<list>
#include<fstream>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
const ll E=1e18+7;
#define F first
#define S second
#define MK make_pair
const ll MOD=1000000007;



int main(){
    vector<ll> a={2,3,4,8,9,10};
    vector<ll> ret;
    ll n;
    cin>>n;
    if(n<100){
        ret={2,5,63};
        for(ll i=1;ret.size()<n;i++){
            ret.push_back(70*i);
        }
    }
    else{
        for(ll i=0;i<30000/12 && ret.size()+6<=n;i++){
            for(ll t=0;t<a.size();t++){
                ret.push_back(i*12+a[t]);
            }
        }
        for(ll i=1;ret.size()<n;i++){
            ret.push_back(6*i);
        }
    }
    sort(ret.begin(),ret.end());
    for(int i=0;i<ret.size();i++){
        cout<<ret[i];
        if(i!=ret.size()-1){cout<<" ";}
    }
    cout<<endl;
    
    
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<climits>

#define pb push_back
#define rep(i, a, n) for(int (i)=a; (i)<(n); (i)++)
#define FOR(i, n) rep(i, 0, n)
#define F(n) FOR(i, n)
#define FF(n) FOR(j, n)
#define repi(i, a, n) for(int (i)=a; (i)<=(n); (i)++)
#define FORI(i, n) repi(i, 1, n)
#define FI(n) FORI(i, n)
#define FFI(n) FORI(j, n)
#define IN(x) int x; cin>>(x);
#define SIN(x) string x; cin>>(x);
#define INN(x, y) int x, y; cin>>(x)>>(y);
#define INFO(a) cout<<"info "<<a<<endl
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define vpii vector<pair<int, int> >
#define sortv(x) sort((x).begin(), (x).end())
#define sortvd(x) sort((x).begin(), (x).end(), greater<int>())
#define lboundv(x,v) lower_bound((x).begin(),(x).end(),(v))-(x).begin();
#define uboundv(x,v) upper_bound((x).begin(),(x).end(),(v))-(x).begin();
#define ite iterator
#define fi first
#define se second
#define mems(a, v) memset((a), (v), sizeof((a)))
#define lmid(l, r) ((l)+(r)-1)/2
#define rmid(l, r) ((l)+(r))/2+1
#define mp make_pair

typedef long long ll;
typedef long double LD;

using namespace std;

#define N 300005

int main() {
	ios::sync_with_stdio(0);
    IN(n);
    vi a(n);
    F(n) {
        cin>>a[i];
    }
    sortv(a);
    vll s(n);
    s[0] = a[0];
    FI(n-1) s[i] = s[i-1]+a[i];
    ll ans = 0;
    if(n==2) {
        cout<<a[1]-a[0]<<endl;
        return 0;
    }
    if(n&1) {
        int l = n/2-1;
        ans = 2*(s[n-1]-s[l]) - a[l+1] - a[l+2];
        ans -= 2*s[l];
        ll ans1 = 2*(s[n-1]-s[l+1]);
        ans1 -= 2*s[l+1] - a[l+1] - a[l];
        ans = max(ans, ans1);
    }
    else {
        int l = n/2-1;
        ans = 2*(s[n-1]-s[l])-a[l+1];
        ans -= 2*s[l]-a[l];
    }
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <tuple>
#include <stdbool.h>
#include <bitset>
#include <string>
#include <boost/multiprecision/cpp_int.hpp>

namespace mp = boost::multiprecision;
using namespace std;


int main(void) {
    int d;
    cin >> d;
    switch(d) {
        case 25:
            cout << "Christmas" << endl;
            break;
        case 24:
            cout << "Christmas Eve" << endl;
            break;
        case 23:
            cout << "Christmas Eve Eve" << endl;
            break;
        case 22:
            cout << "Christmas Eve Eve Eve" << endl;
            break;
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iterator>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <string>
#include <vector>
#include <limits>
#include <queue>
#include <cmath>
#include <map>
#include <set>

using namespace std;

using ll = long long;

int main()
{
    string s;
    string t;
    cin >> s >> t;

    ll out = 0;
    for(int i = 0; i < 3; ++i)
        out += (s[i] == t[i]);

    cout << out << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define repi(i, a, b) for (long long i = (long long)(a); i < (long long)(b); i++)
#define drep(i, n) for (long long i = n - 1; i > 0; i--)
#define pb push_back
#define pb push_back
#define all(x) (x).begin(), (x).end()

using namespace std;

int main()
{
    int n;
    cin >> n;
    if ((n / 10) % 111 == 0 || (n % 1000) % 111 == 0)
    {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
char s[100005];

int read()
{
	int x = 0,f = 1;
	char ch= getchar();
	while(ch<'0' || ch>'9')
	{
		if(ch == '-')
			f=-1;
		ch = getchar();
	} 
	while(ch>='0' && ch<='9')
	{
		x = (x<<1) + (x<<3) + ch-'0';
		ch = getchar();
	}
	return x*f;
}

int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	scanf("%d", &n);
	scanf("%s", s + 1);
	int len = strlen(s + 1);
	int ans = 1;
	for(int i = 2;i <= len;i++)
	{
		if(s[i] != s[i - 1])
			ans++;
	}
	printf("%d", ans);
	return 0;
} 

Measured memory_bytes: 384
use std::io::Read;
use std::cmp::max;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();

    let mut a: Vec<i64> = Vec::with_capacity(n + 1);
    for _i in 0..(n + 1) {
        a.push(iterator.next().unwrap().parse().unwrap());
    }

    let mut before: i64 = 0;
    for &ai in &a {
        before += ai;
    }

    for i in 0..n {
        let mut b: i64 = iterator.next().unwrap().parse().unwrap();
        if a[i] < b {
            b -= a[i];
            a[i] = 0;
            a[i + 1] = max(0, a[i + 1] - b);
        } else {
            a[i] -= b;
        }
    }

    let mut after: i64 = 0;
    for &ai in &a {
        after += ai;
    }

    let ans: i64 = before - after;

    return ans.to_string();
}


Measured memory_bytes: 10232
// https://atcoder.jp/contests/abc171/tasks/abc171_b

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;

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

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

template <typename T>
inline ll len(V<T> arr) {
  return arr.size();
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

#ifndef TEST
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

void solve() {
  ll N, K;
  cin >> N >> K;

  VL ps(N);
  rep(i, N) cin >> ps[i];

  sort(all(ps));
  ll res = 0;
  rep(i, K) res += ps[i];

  cout << res << "\n";
}


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


int main() {
    
    int n,k;
    cin>>n>>k;
    vector<int> vec(n,0);
    for(int i=0;i<n;i++)cin>>vec[i];
    vector<int> dp(n,INT_MAX);
    dp[n-1]=0;
    for(int i=n-2;i>=0;i--){
        for(int j=1;j<=k&&(i+j)<n;j++){
        int sum=dp[i+j]+abs(vec[i+j]-vec[i]);
        if(dp[i]>sum)dp[i]=sum;
        }
    }
    
    cout <<dp[0]<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>  
#define ll long long
#define mk make_pair
#define y1 yyy
using namespace std;

const int N = 5e5 + 5;

int n, m, a[N], b[N], cnt[N], ans;

int main() {
	cin >> n >> m;
	for (int i = 1; i <= n; i++) scanf("%d", a + i), b[a[i]]++;
	for (int i = 1; i <= n; i++)
		for (int j = i - b[i] + 1; j <= i; j++)
			if (j > 0) cnt[j]++;
	ans = 0;
	for (int i = 1; i <= n; i++)
		if (cnt[i] == 0) ans++;
	while (m--) {
		int x, y;
		scanf("%d %d", &x, &y);
		b[a[x]]--;
		if (a[x] - b[a[x]] > 0) {
			cnt[a[x] - b[a[x]]]--;
			if (cnt[a[x] - b[a[x]]] == 0) ans++;
		}
		if (y - b[y] > 0) {
			cnt[y - b[y]]++;
			if (cnt[y - b[y]] == 1) ans--;
		}
		b[y]++;
		a[x] = y;
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

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

    int ans = 0;
    for (int i = 1; i < N; i++)
    {
        if (a[i - 1] == a[i])
        {
            ans++;
            a[i] = 10000 + ans;
        }
    }

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

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

#define FAST_IO ios_base::sync_with_stdio(false), cin.tie(nullptr)
#define setIO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)
#define trav(e, x) for (auto &(e) : (x))
#define pb(x) push_back(x)
#define eb(x...) emplace_back(x)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int) (x).size()
#define lc(i) 2 * i
#define rc(i) 2 * i + 1
//#define int long long
using namespace std;
using vi = vector<int>;
using ii = pair<int, int>;

const int MAXN = 1e5, INF = 1e9 + 5, MOD = 1e9 + 7;

struct SegmentTree {
    int n;
    vi a, t;

    int merge(int x, int y) { return x + y; }

    void build(int i, int l, int r) {
        if (l == r) {
            t[i] = a[l];
            return;
        }
        int mid = (l + r) / 2;
        build(lc(i), l, mid);
        build(rc(i), mid + 1, r);
        t[i] = merge(t[lc(i)], t[rc(i)]);
    }

    SegmentTree(int x, vi y) {
        n = x;
        a = y;
        t.assign(4 * n, 0);
        build(1, 0, n - 1);
    }

    void modify(int i, int l, int r, int pos, int val) {
        if (l > pos || r < pos) return;
        if (l >= pos && r <= pos) {
            t[i] = val;
            return;
        }
        int mid = (l + r) / 2;
        modify(lc(i), l, mid, pos, val);
        modify(rc(i), mid + 1, r, pos, val);
        t[i] = merge(t[lc(i)], t[rc(i)]);
    }

    int query(int i, int l, int r, int ql, int qr) {
        if (l > qr || r < ql) return 0;
        if (l >= ql && r <= qr) return t[i];
        int mid = (l + r) / 2;
        int resL = query(lc(i), l, mid, ql, qr);
        int resR = query(rc(i), mid + 1, r, ql, qr);
        return merge(resL, resR);
    }

    void modify(int p, int v) { modify(1, 0, n - 1, p, v); }

    int query(int l, int r) { return query(1, 0, n - 1, l, r); }
};

signed main() {
    FAST_IO;
//    setIO("input.txt", "output.txt");

    int n, q;
    cin >> n >> q;
    vi a(n);
    trav(x, a) {
        cin >> x;
        x--;
    }
    vector<ii> queries[n];
    for (int i = 0; i < q; i++) {
        int l, r;
        cin >> l >> r;
        l--, r--;
        queries[r].eb(l, i);
    }
    vi last(n, -1), ans(q);
    SegmentTree freq(n, vi(n, 0));
    for (int i = 0; i < n; i++) {
        if (last[a[i]] != -1) freq.modify(last[a[i]], 0);
        last[a[i]] = i;
        freq.modify(i, 1);
        for (auto query : queries[i]) {
            int l = query.first;
            int idx = query.second;
            ans[idx] = freq.query(l, i);
        }

    }
    for (int i = 0; i < q; i++) cout << ans[i] << "\n";
}


Measured memory_bytes: 42372
import java.util.Scanner;

public class Main{
	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);
		String a=sc.next();
		String s[]=new String[3];
		int count=0;
		s=a.split("");
		for(int i=0;i<3;i++){
			if(s[i].equals("1")){
				count++;
			}
		}

		System.out.println(count);

	}
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
#define pans cout<<ans<<endl;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod を計算する
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

long long nCr(int n, int r) {
    long long ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = (ans*i)%1000000007;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = (ans * modinv(i,1000000007))%1000000007;
    }
    return ans;
}

int main(){
    long long n,k;cin>>n>>k;
    for(int i=1;i<=k;i++){
      cout<<(nCr(k-1,i-1)*nCr(n-k+1,i))%1000000007<<endl;
    }
	return 0;
}

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

bool isPrime(int x) {
   for(int i = 2; i < x; i++) {
      if(x % i == 0)
      return false;
   }
   return true;
}
void solve() {
   int x;
   cin >> x;
   for(int i = x; ; i++) {
      if(isPrime(i)) {
         cout << i << endl;
         return;
      }
   }
}

int main() {
   cin.tie(0);
   cin.sync_with_stdio(0);
   int testcase = 1;
   // cin >> testcase;
 
   for(int i = 0; i < testcase; i++) {
      solve();
   } 
   return 0;
}


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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)   
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

const ll MOD = 1e9+7;

int main(){
    ll n,cnt = 0;
    cin >> n;
    ll a[n] = {};

    rep(i,0,n) cin >> a[i];

    rep(i,0,n-1){
        rep(j,0,n-1){
            if(a[j] > a[j+1]){
                swap(a[j],a[j+1]);
                cnt++;
            }
        }
    }
    rep(i,0,n){
        printf("%lld%s", a[i], (i == n-1)? "\n": " ");
    }
    cout << cnt << endl;
    return 0;
}



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

long long my_min(long long x, long long y) {
  if (x > y) return y;
  else return x;
}

int main() {
  
  int D;
  long long G;
  cin >> D >> G;
  
  vector<int> p(D);
  vector<long long> c(D);
  
  for (int i = 0; i < D; i++) {
    cin >> p[i] >> c[i];
  }
  
  int ans = 1010;
  
  // 100(j+1)点の問題を中途半端に解くとする
  
  for (int j = 0; j < D; j++) {
    
    // 100(j+1)点の問題以外で解き切る問題の種類をbit探索
    
    for (int bit = 0; bit < (1<<D); bit++) {
      
      // 100(j+1)点の問題以外の得点と解いた問題数を求める
      
      long long point = 0;
      int que = 0;
      
      for (int i = 0; i < D; i++) {
        if (i == j) continue;
        if (bit & (1<<i)) {
          point += (p[i] * 100 * (i + 1) + c[i]);
          que += p[i];
        }
      }
        
      // 100(j+1)点の問題を何問といてG点に達するか
      
      if (point >= G) {
        ans = min(ans, que);
        continue;
      }
        
      if (point + p[j] * 100 * (j + 1) + c[j] < G) continue;
      
      if (point + p[j] * 100 * (j + 1) >= G) {
        ans = my_min(ans, que + (G - point - 1) / (100 * (j + 1)) + 1);
        continue;
      }
      
      ans = min(ans, que + p[j]);
      
    }
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
import java.io.ByteArrayInputStream;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
    private static long solve(Scanner scanner) {
        scanner.nextLine();
        String s1 = scanner.nextLine();
        String s2 = scanner.nextLine();

        boolean lastPattern;
        boolean pattern;
        int pointer;
        long ret;

        if (s1.charAt(0) == s2.charAt(0)) {
            lastPattern = true;
            pointer = 1;
            ret = 3;
        } else {
            lastPattern = false;
            pointer = 2;
            ret = 6;
        }

        while(pointer < s1.length()) {
            pattern = s1.charAt(pointer) == s2.charAt(pointer);

            if (lastPattern) {
//                ret *= 2;
                ret = mod1000000007(ret, 2L);
            } else if (pattern) {
                ret = ret;
            } else {
//                ret *= 3;
                ret = mod1000000007(ret, 3L);
            }

            pointer += pattern ? 1 : 2;

            lastPattern = pattern;
        }

        return ret % 1000000007;
    }

    private static long mod1000000007(long a, long b) {
        return ((a % 1000000007) * (b % 1000000007)) % 1000000007;
    }

    public static void main(String[] args) {
//        tests();

        Scanner scanner = new Scanner(System.in);
        System.out.println(solve(scanner));
    }

    private static String ex1 = "3\n" +
            "aab\n" +
            "ccb";
    private static String ex2 = "1\n" +
            "Z\n" +
            "Z";
    private static String ex3 = "52\n" +
            "RvvttdWIyyPPQFFZZssffEEkkaSSDKqcibbeYrhAljCCGGJppHHn\n" +
            "RLLwwdWIxxNNQUUXXVVMMooBBaggDKqcimmeYrhAljOOTTJuuzzn";

    private static String ex4 = "3\n" +
            "aabd\n" +
            "ccbd";
    private static String ex5 = "3\n" +
            "aabdee\n" +
            "ccbdff";

    private static void tests() {
        System.out.println(solve(new Scanner(testCaseToInputStream(ex1))));
        System.out.println(solve(new Scanner(testCaseToInputStream(ex2))));
        System.out.println(solve(new Scanner(testCaseToInputStream(ex3))));
        System.out.println(solve(new Scanner(testCaseToInputStream(ex4))));
        System.out.println(solve(new Scanner(testCaseToInputStream(ex5))));
    }

    private static ByteArrayInputStream testCaseToInputStream(String ex) {
        try {
            return new ByteArrayInputStream(ex.getBytes("utf-8"));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            throw new RuntimeException();
        }
    }

    private static int[] lineTointNums(String line) {
        String[] numStrs = line.split(" ");
        int[] nums = new int[numStrs.length];
        for (int i = 0; i < nums.length; i ++) {
            nums[i] = Integer.parseInt(numStrs[i]);
        }
        return nums;
    }
}


Measured memory_bytes: 21844
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>

using namespace std;

#define mod 1000000007

int main()
{
	long long int n, a, b;
	cin >> n >> a >> b;
	long long int ans = 0;
	long long int x[100001];
	for(int i = 0; i < n; i++){
		cin >> x [i];
	}
	for(int i = 1; i < n; i++){
		ans += min(a * (x[i] - x[i - 1]), b);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;

namespace test
{
    class Program
    {
        static int[] ReadNumList()
        {
            var line = Console.ReadLine().Split(' ');
            var numList = new int[line.Length];
            for (var i = 0; i < line.Length; ++i)
            {
                numList[i] = int.Parse(line[i]);
            }
            return numList;
        }
        static void Main(string[] args)
        {
            var input = ReadNumList();
            var wake = input[0] * 60 + input[1];
            var sleep = input[2] * 60 + input[3];
            var k = input[4];

            Console.WriteLine(sleep - wake - k);
        }
    }
}


Measured memory_bytes: 27236
#include <iostream>

using namespace std;

int main(void) {
  int five, seven;
  int A, B, C;
  cin >> A >> B >> C;
  five = 0;
  seven = 0;
  if(A == 5) five++;
  if(B == 5) five++;
  if(C == 5) five++;
  if(A == 7) seven++;
  if(B == 7) seven++;
  if(C == 7) seven++;
  if(five == 2 && seven == 1) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<iostream>
#define ll long long
using namespace std;
int main()
{
    int n,a,i,b,c,d;
    while(~scanf("%d",&n))
    {
        b=0;
        c=0;
        for(i=0; i<n; i++)
        {
            scanf("%d",&a);
            if(a%2==0)
            {
                if(a%4==0) b++;
                else c++;
            }
        }
            d=b*2+1+c;
            if(b==0) d--;
            if(c%2==1) d--;
            if(d>=n) printf("Yes\n");
            else printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

const int MAX_N = 1000;

typedef pair<int, int> P;

void compress(vector<int> &v) {
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(),v.end()),v.end());
}

int lb(vector<int> v, int num){
	return lower_bound(all(v), num) - v.begin();
}

const int dy[16] = { 0,-1, 0, 1, 1,-1, 1,-1, 0,-2, 0, 2};
const int dx[16] = { 1, 0,-1, 0, 1, 1,-1,-1, 2, 0,-2, 0};
void bfs(int y, int x, bool used[MAX_N][MAX_N], int m[MAX_N][MAX_N]){
	queue<pair<int, int>> q;
	q.push(make_pair(y,x));

	while(not q.empty()){
		pair<int, int> cur = q.front(); q.pop();
		if(used[cur.first][cur.second]) continue;
		used[cur.first][cur.second] = true;

		rep(i,4){
			int ny = cur.first + dy[i];
			int nx = cur.second + dx[i];
			if(ny < 0 || ny >= MAX_N || nx < 0 || nx >= MAX_N) continue;
			if(m[ny][nx] == 0){
				q.push(make_pair(ny,nx));
			}
		}
	}
}

int main(){
	int n;
	while(cin >> n,n){
		pair<P,P> p[55];
		vector<int> x,y;
		rep(i,n){
			int a, b, c, d;
			cin >> a >> b >> c >> d;
			p[i] = make_pair(P{a,b}, P{c,d});

			range(i,-1,2) x.emplace_back(a + i);
			range(i,-1,2) x.emplace_back(c + i);
			range(i,-1,2) y.emplace_back(b + i);
			range(i,-1,2) y.emplace_back(d + i);
		}

		compress(x);
		compress(y);

		int m[MAX_N][MAX_N] = {{0}};
		rep(i,n){ //????????????????????§?¨????????????§???y???????????????????????§?°???¢????????????
			int lx = lb(x, p[i].first.first);
			int ly = lb(y, p[i].first.second);
			int rx = lb(x, p[i].second.first);
			int ry = lb(y, p[i].second.second);
			lx *= 2; rx *= 2; ly *= 2; ry *= 2;

			//cout << lx << ' ' << ry << ' ' << rx << ' ' << ly << endl;
			//range(j,ry,ly + 1){ range(k,lx,rx + 1){ m[j][k]++; } }
			range(j,ry,ly + 1){
				m[j][lx]++;
				m[j][rx]++;
			}
			range(j,lx,rx + 1){
				m[ry][j]++;
				m[ly][j]++;
			}
		}
		//rep(i,n * 5){ rep(j, n * 5){ cout << (m[i][j] == 0 ? '_' : '*') << ' ' ; } cout << endl; }

		bool used[MAX_N][MAX_N] = {{0}};
		int cnt = 0;
		rep(i,MAX_N){
			rep(j,MAX_N){
				if(not used[i][j] && m[i][j] == 0){
					cnt++;
					bfs(i,j,used,m);
					//show(i) show(j) rep(k,n * 5){ rep(l,n * 5){ cout << (used[k][l] ? '*' : '_') << ' '; } cout << endl; }
				}
			}
		}
		cout << cnt << endl;
	}
}

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

int n,m,a[200100];
long long Ans;
map<int,int> M;
signed main()
{
	cin >> n >> m; a[0]=1;
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]),
		a[i]=(1ll*a[i-1]+a[i])%m;
	for(int i=0;i<=n;i++)
		Ans+=M[a[i]],M[a[i]]++;
	cout << Ans << endl;
	return 0;
}

Measured memory_bytes: 4992
#include <stdio.h>
#include <math.h>
int isP(int x){
	if (x<2) return 0;
	if (x==2) return 1;
	if (x%2==0) return 0;
	int r=sqrt(x);
	for (int i=3;i<=r;i+=2){
		if (x%i==0) return 0;
	}
	return 1;
}
int main(){
	int X;
	scanf("%d", &X);
	while (!isP(X)) X++;
	printf("%d\n", X);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
const ll N = 1000030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    1e9+7;
vector<int> v;
int n,k;
bool fun(int x)
{
	while(x)
	{
		int y=x%10;
		x/=10;
		for(auto z:v)
		if(z==y)
		return false;
	}
	return true;
}
int main()
{
		ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
cin>>n>>k;
rep(i,0,k)

{
	int x;
	cin>>x;
	v.push_back(x);
}
while(1)
{
	if(fun(n))
	{
		cout<<n;
		return 0;
	}
	else
	n++;
}

}

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

int main(){
    int N;
    cin >> N;
    typedef pair<int, int> vals;
    priority_queue<vals> que;
    int tmp;
    for(int i=0; i<N; i++){
        cin >> tmp;
        vals tmp_val = make_pair(tmp, i);
        que.push(tmp_val);
    }

    vals max_val = que.top();
    int max_value = max_val.first;
    int max_index = max_val.second;
    que.pop();
    max_val = que.top();
    int second_max_value = max_val.first;

    for(int i=0; i<N; i++){
        if(i==max_index){
            cout << second_max_value << "\n";
        }else{
            cout << max_value << "\n";
        }
    }

    return 0;

}

Measured memory_bytes: 5240
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

int main(int argc, char **argv) {
	int N;
	cin >> N;
	int i = 1, s;
	while ((s = i * (i + 1) / 2) < N) ++i;
	FOR(j, 1, i + 1) if (s - N != j) cout << j << endl;
	return 0;
}


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

#define gcd(m,n) __gcd(m,n)
#define lcm(m,n) m*(n/gcd(m,n))
#define fast std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pi acos(-1.0)
#define endl '\n'
#define MOD 1000000007
#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define dbg(x) cout << #x << "  " << x << endl;

ll power(ll base, ll exp) 
{ll res=1;while(exp>0) {if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return res;}
ll mod(ll a, ll b) {return (a % b + b) % b;}

using namespace std;


int main() 
{	
	fast;
	ll N,K; cin>>N>>K;
	ll t = N % K;
	if(t == 0) cout << 0 << endl;
	else
	{
		cout << min(t,abs(t-K)) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define cpresent(c,x) ((c).find(x) != (c).end()) 
#define vpresent(c,x) (find(all(c),x) != (c).end())
#define endl '\n'
#define ff first
#define ss second
#ifdef LOCAL
#include "/home/iggaboi/Desktop/CP/debug.h"
#else
#define debug(Args...)
#endif
using ll = long long;
using namespace __gnu_pbds;
using namespace std;
template<class T>
using indexed_set = tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>;

void shit() {
	int n; cin >> n;
    map<string, int> mp;
    for(int i = 0; i < n; ++i) {
        string s; cin >> s;
        if(s == "AC") ++mp["AC"];
        if(s == "WA") ++mp["WA"];
        if(s == "TLE") ++mp["TLE"];
        if(s == "RE") ++mp["RE"];
    }
    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;
}

int32_t main() {
	ios_base::sync_with_stdio(false),cin.tie(nullptr);
	// int t; cin >> t;
	// while(t--)
		shit();
	return 0;
}



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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main(){
int X;
cin >> X;
int ans = 0;
if(X == 1) {
    print(1);
    return 0;
}else{
    for(int i = 2; i < X; i++){
        int j = 2;
        while(ans < X){
            int now = pow(i, j);
            if(now > X) break;
            else ans = max(ans, now);
            j++;
        }
    }
}
print(ans);
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, x);
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

int gcd(int a, int b)
{
	if (b == 0)
		return a;
	return gcd(b, a % b);
}

int lcm(int a, int b) { return a * b / gcd(a, b); }

int main(void)
{
	vector<int> a = {1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
	int x, y;
	cin >> x >> y;
	((a[x - 1] == a[y - 1]) ? (cout << "Yes" << endl) : (cout << "No" << endl));
	return 0;
}

Measured memory_bytes: 256
module gcd_function
   implicit none

   interface gcd
      module procedure gcd_4, gcd_8, gcd_three_4, gcd_three_8
   end interface

contains

   function gcd_4(a,b)
      implicit none
      integer :: gcd_4
      integer, intent(in) :: a, b
      integer :: l, m, n

      m = a
      n = b

      do
         l = mod(m,n)
         if (l == 0) exit
         m = n
         n = l
      end do

      gcd_4 = n
      return
   end function gcd_4

   function gcd_8(a,b)
      implicit none
      integer(8) :: gcd_8
      integer(8), intent(in) :: a, b
      integer(8) :: l, m, n

      m = a
      n = b

      do
         l = mod(m,n)
         if (l == 0) exit
         m = n
         n = l
      end do

      gcd_8 = n
      return
   end function gcd_8

   function gcd_three_4(a,b,c)
      integer :: gcd_three_4
      integer, intent(in) :: a, b, c

      gcd_three_4 = gcd( gcd(a, b), c)
   end function gcd_three_4

   function gcd_three_8(a,b,c)
      integer(8) :: gcd_three_8
      integer(8), intent(in) :: a, b, c

      gcd_three_8 = gcd( gcd(a, b), c)
   end function gcd_three_8

end module gcd_function

program abc162a
   use gcd_function
   implicit none
   integer :: K, p, q, r
   integer, allocatable :: a(:,:,:)

   read(*,*) K
   allocate(a(k,k,k))

   do r = 1, k
      do q = 1, k
         do p = 1, k
            a(p,q,r) = gcd(p,q,r)
         enddo
      enddo
   enddo

   write(*,*) sum(a(:,:,:))

end program abc162a


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

string s, t;

void solve()
{
    int n = 3;
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        if (s[i] == t[i])
        {
            ans++;
        }
    }
    cout << ans << endl;
}

int main()
{
    cin >> s >> t;

    solve();
}


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

void solve(int m, int n){
	bool a[7456789] = {};
	int t = m;
	for(int i=0; i<=n; ++i){
		while(a[t]) ++t;
		if(i == n){
			cout << t << "\n";
			return;
		}
		for(int j=t; j<7456789; j+=t) a[j] = true;
	}
}

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	while(1){
		int m, n;
		cin >> m >> n;
		if(m == 0 && n == 0) return 0;
		solve(m, n);
	}
}


Measured memory_bytes: 10348
#include <bits/stdc++.h>
#include <chrono>
#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 
#define fo(i,z,n) for(int i = z;i<n;i++)
#define Fo(i,z,n) for(ll i = z;i<n;i++)
#define INT_BITS 32
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> > 
#define pb push_back
#define f first
// #define s second
#define int long long
#define float long double
#define all(c) (c).begin(), (c).end()
#define endl '\n'
#define pi 3.14159265358979323846

ll pow(ll a,ll p,ll m=mod)
{ll res=1;while(p>0){if(p&1)res=(res*a)%m;a=(a*a)%m;p>>=1;}
return res;}



int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);
   	
 //    int t;
 //     cin >> t;

 //     while(t--){

 // }

     string t,s;
     cin >> t >> s;
     string p = s.substr(0,(int)t.length());
     if(p == t)cout << "Yes" << endl;
     else cout << "No" << endl;


return 0;
	
	}




Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {

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

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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--)
#define FORA(i, I) for (const auto &i : I)

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

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
  pr(b);
}

int ans = 0;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{

  string s[3] = {"Sunny", "Cloudy", "Rainy"};
  string x;
  cin >> x;
  if (x[0] == 'S')
    pr(s[1]);
  else if (x[0] == 'C')
    pr(s[2]);
  else
    pr(s[0]);
}



Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
//f[i][j] i个取sum = j 的是否可行
int n,a[101],f[101][10101];
int main(){
	int i,j;
	scanf("%d",&n);
	for(i=1;i<=n;i++)scanf("%d",a+i);
	f[0][0]=1;
	for(i=1;i<=n;i++){
		for(j=10100;j>=a[i];j--)
			f[i][j]=f[i-1][j]|f[i-1][j-a[i]];
		for(j=a[i]-1;~j;j--)f[i][j]=f[i-1][j];
	}
	for(j=10100;~j;j--){
		if(f[n][j]&&j%10!=0){
			cout<<j;return 0;
		}
	}cout<<0;
			 
} 

Measured memory_bytes: 4224
A,B,C = map(int,input().split())
D,E,F = map(int,input().split())
G,H,I = map(int,input().split())
N =int(input())
s = [int(input()) for _ in range(N)]

initial_board = [A,B,C,D,E,F,G,H,I]
called = [0]*9

for i in range(9):
  if initial_board[i] in s:
    called[i] = 1

if ((called[0] == 1)and (called[1] == 1)and(called[2] == 1)) or\
((called[3] == 1)and (called[4] == 1)and(called[5] == 1)) or\
((called[6] == 1)and (called[7] == 1)and(called[8] == 1)) or\
((called[0] == 1)and (called[3] == 1)and(called[6] == 1)) or\
((called[1] == 1)and (called[4] == 1)and(called[7] == 1)) or\
((called[2] == 1)and (called[5] == 1)and(called[8] == 1)) or\
((called[0] == 1)and (called[4] == 1)and(called[8] == 1)) or\
((called[2] == 1)and (called[4] == 1)and(called[6] == 1)):
  print("Yes")
else:
  print("No")
  

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
void SA();
void SB();
void SC();
string sa,sb,sc;
int i=0,j=0,k=0;
char a='Z';

int main(){
  cin>>sa>>sb>>sc;
  SA();
  cout<<a<<endl;
  return 0;
} 

void SA(){
  i++;
  if(i-1==sa.size() && a=='Z')a='A';
  if(sa[i-1]=='a')SA();
  if(sa[i-1]=='b')SB();
  else if(sa[i-1]=='c')SC();
}

void SB(){
  j++;
  if(j-1==sb.size() && a=='Z')a='B';
  if(sb[j-1]=='a')SA();
  else if(sb[j-1]=='b')SB();
  else if(sb[j-1]=='c')SC();
}

void SC(){
 k++;
 if(k-1==sc.size() && a=='Z')a='C';
 if(sc[k-1]=='a')SA();
 else if(sc[k-1]=='b')SB();
 else if(sc[k-1]=='c')SC();
}


Measured memory_bytes: 256
//
//  main.cpp
//  CoderTest
//
//  Created by yuya on 2019/05/20.
//  Copyright © 2019 yuya. All rights reserved.
//

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



int main(){
    int i;
    int j,l;
    int N,K;
    ll maxvalue = 0;
    
    cin >> N >> K;
    
    vector<ll> V(N);
    
    for(i=0;i<N;i++) cin >> V[i];
    
    
    for(i=0 ; i<=min(K, N) ; i++){   // i個とる (とりあえず捨てない)
        for(j=0;j<=i;j++){   // 左からj個, 右からi-j個
            
            vector<ll> mine(0);
            
            for(l=0;l<j;l++){
                mine.push_back(V[l]);
            }
            for(l=N-1; l > N-1 - (i-j)  ; l--){
                mine.push_back(V[l]);
            }
            
            /*
            ///////////////
            cout << "捨てる前" << " ";
            for(l=0;l<mine.size();l++) cout << mine[l] << " ";
            cout << endl << mine.size() << endl;
            ///////////////
            */
            
            sort(mine.begin(),mine.end());
            
            l=0;
            while(l < K-i && l < mine.size() && mine[l] < 0){  //捨てる
                mine[l] = 0;
                l++;
            }
            
            /*
            ///////////////
            cout << "捨てた後" << " ";
            for(l=0;l<mine.size();l++) cout << mine[l] << " ";
            cout << endl;
            ///////////////
            */
            
            maxvalue = max( maxvalue, accumulate(mine.begin(), mine.end(), 0LL) );
        }
    }
    
    cout << maxvalue << endl;
    
    return 0;
}





Measured memory_bytes: 256
N,W=map(int,input().split())
lw=[]
lv=[]
for i in range(N):
    w,v=map(int,input().split())
    lw.append(w)
    lv.append(v)
ldp=[[float("inf") for j in range(10**5)] for i in range(N)]
for j in range(10**5):
    if lv[0]>=j+1:
        ldp[0][j]=lw[0]
for i in range(1,N):
    for j in range(10**5):
        ldp[i][j]=min(ldp[i-1][j],ldp[i-1][j+1-lv[i]-1]+lw[i] if j+1-lv[i]>0 else lw[i])
for j in range(10**5-1,-1,-1):
    if ldp[N-1][j]<=W:
        print(j+1)
        break


Measured memory_bytes: 319764
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define reps(i, s, n) for(int i = (s); i < (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, s, n) for(int i = (n) - 1; i >= (s); i--)
#define INF ~(1 << 31)
#define INFL ~(1LL << 63)

int main()
{
    string s, t;
    cin >> s >> t;

    int ss = s.size();
    int st = t.size();
    int ans = 1000;
    rep(i, ss - st + 1){
        int cnt = 0;
        rep(j, st){
            if(t[j] != s[i+j]) cnt++;
        }
        ans = min(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628