akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  prllf("%d",x);
#define pl(x)  prllf("%lld",x);
#define pf(x)  prllf("%.10lf",x);
#define ps(x)  prllf("%s",x);
#define en() prllf("\n");
#define random_shuffle(r...)random_shuffle(r,[](int _){return rand()%_;})
#define SQR(a) (a)*(a)
#define mod 100000007
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}
template <typename T> T POW(T B,T P){ if(P==0) return 1; if(P&1) return B*POW(B,P-1);  else return SQR(POW(B,P/2));}
ll powmod(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%mod;a = a*a%mod;b >>= 1;}return ans;}
ll prime[1000000];bool visprime[10000000];
void sieve(){ll k=0;for(ll i=2;i*i<=1000000;i++){for(ll j=i*i;j<=1000000;j+=i){visprime[j]=true;}}for(ll i=2;i<=1000000;i++){if(visprime[i]==false) prime[k++]=i;}}


int main()
{
    int n,p,q;
    cin>>n>>p>>q;
    int arr[n+2];
    for(int i=1;i<=n;i++) arr[i]=p;


    int lazy=0;


    for(int i=1;i<=q;i++)
    {
       int x;
       cin>>x;
       arr[x]++;
       lazy++;

    }
    for(int i=1;i<=n;i++)
         {
             if(arr[i]-lazy>0) cout<<"Yes"<<endl;
             else cout<<"No"<<endl;
         }




}
























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

bool __greater__(long long a, long long b)
{
	return a > b;
}

int main()
{
	int N;
	cin >> N;
	long long strength;
	vector<long long> stren_vec;
	int count=0;
	while (cin >> strength)
	{

		stren_vec.push_back(strength);
		count++;
		if (count == 3 * N)
			break;
		
	}
	sort(stren_vec.begin(), stren_vec.end(), __greater__);
	long long res=0;
	for (int i = 1; i < 2*N; i+=2)
	{
		res += stren_vec[i];
	}
	cout << res << endl;


	return 0;
}

Measured memory_bytes: 6384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1); I >= (A); --I)
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	set<ll> s;
	FOR(i,0,3){
		ll k;
		cin>>k;
		s.insert(k);
	}
	cout << s.size() << endl;
}	

Measured memory_bytes: 256
str_len = int(input())
input_str = input()
target_char_num = int(input())
target_char = input_str[target_char_num-1]

#print(str_len,input_str,target_char)

print_str = ''

for i in range(str_len):
  if input_str[i] != target_char:
    print_str = print_str + '*'
  else:
    print_str = print_str + target_char

print(print_str)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define pb push_back
#define mkp make_pair
#define ll long long
using namespace std;
double dip(ll n,vector<double>arr)
{ll i,j;
	 double dp[n+1][n+1],ans=0;
	 for(i=0;i<=n;i++)
	 {
	 	for(j=0;j<=n;j++)
	 	{
	 		if(!i||!j)
	 		{
	 			if(!i)dp[i][j]=0;
	 			if(!j)dp[i][j]=((i==0?1:(1-arr[i-1])*dp[i-1][j]));
			 }
			 else
			 dp[i][j]=arr[i-1]*dp[i-1][j-1]+(1-arr[i-1])*dp[i-1][j];
		 }
	 }
////	 for(i=0;i<=n;i++){for(j=0;j<=n;j++)cout<<dp[i][j]<<" ";cout<<endl;}
	 for(i=n,j=n/2+1;j<=n;j++)ans+=dp[i][j];
	 return ans;
}
int main()
{
	ll n,i,j;
	cin>>n;
	vector<double> arr(n);
	for(i=0;i<n;i++)cin>>arr[i];
	double x=dip(n,arr);
	cout<<setprecision(10)<<x;
	return 0;
}

Measured memory_bytes: 70656
#include <stdio.h>
#include <string.h>

struct stringcnt {
  char str[16];
  int cnt;
};

int main() {
  struct stringcnt sc[111] = {0};
  int top = 0;
  int N, M;
  int i;
  int max = 0;
  
  scanf("%d", &N);
  for(i = 0; i < N; i++) {
    char tmpstr[16];
    int flag = 0;
    
    scanf("%s", tmpstr);
    for(int i = 0; i < top; i++) {
      if(strcmp(sc[i].str, tmpstr) == 0) {
        sc[i].cnt++;
        flag = 1;
        break;
      }
    }
    if(flag == 0) {
      strcpy(sc[top].str, tmpstr);
      sc[top].cnt++;
      top++;
    }
  }
  
  scanf("%d", &M);
  for(i = 0; i < M; i++) {
    char tmpstr[16];
    int flag = 0;
    
    scanf("%s", tmpstr);
    for(int i = 0; i < top; i++) {
      if(strcmp(sc[i].str, tmpstr) == 0) {
        sc[i].cnt--;
        flag = 1;
        break;
      }
    }
    if(flag == 0) {
      strcpy(sc[top].str, tmpstr);
      sc[top].cnt--;
      top++;
    }
  }
  
  for(i = 0; i < top; i++) {
    if(max < sc[i].cnt) max = sc[i].cnt;
  }
  printf("%d\n", max);
  
  return 0;
}
  

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define vi vector <int>
#define vll vector<ll>
#define ii pair<ll,ll>
#define vii vector<ii>
#define F first
#define S second
#define INF 1000000000000000000
#define pi atan(1)*4
#define MOD 1000000000+7L
#define eps 0.0000006
#define MAX_V 10000
 
using namespace std;
 
int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	int n;
	cin >> n;
	int a[n];
	vi sums(1005,0);

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

	sort(a,a+n);

	int total = 0;
	int lower;
	for (int i = n-1; i >= 0; --i){

		for (int j = i-1; j >= 0; --j){
			if(a[j]*2 < a[i]) break;
			int x = a[i]-a[j]+1;
			lower = lower_bound(a,a+n,x)-a;
			if(lower > j) continue;
			total += (j-lower);
		}
	}
	cout << total << '\n';
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int N,i,t=0;
cin >> N;
for(i=1;i<=9;i++){
if(N%i==0&&(N/i)<=9){t++;}
}
if(t==0){cout << "No" << endl;}else{cout << "Yes" <<endl;}
return 0;
}

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

multimap<int,int> arr;

int main(int , char **)
{
	int N;
	ll K;
	cin >> N >> K;

	for(int i=0;i<N;i++){
		int a,b;
		cin >> a >> b;
		arr.emplace(a,b);
	}

	ll c = 0;
	for(auto A : arr){
		c += A.second;
		if (K<=c) {	printf("%d\n",A.first ); break;}
	}

	return 0;
}

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

using namespace std;
using ll = long long;

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

    int all = 0;
    for (int i = 1; i <= N; i++) all += L + i - 1;
    
    int res = 100101;
    int m = 1010101;
    for (int i = 1; i <= N; i++){
        if (abs(all - (all - (L+i-1))) < m){
            m = abs(all - (all - (L+i-1)));
            res = all - (L + i -1);
        }

    }

    cout << res << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
		tree_order_statistics_node_update> ordered_set;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
		tree_order_statistics_node_update> indexed_multiset;



map<int,int>mp;
set<int>s;
int main(){	
	int n, k;
	cin>>n>>k;
	for(int i = 0; i < n ; i++){
		int x ; cin>>x;
		s.insert(x);
		mp[x]++;
	}
	vector<int>vi;
	for(auto it : s){
		vi.push_back(mp[it]);
	}
	long long cnt = 0;
	sort(vi.rbegin() , vi.rend());
	for(int i = 0;  i < min((int)vi.size(),k) ; i++)
		cnt+=vi[i];
	cout<<n-cnt;
    return 0;
}


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

long long c[2010][2010] = {}, mod = 1e9+7;

void init() {
    for (int i = 0; i < 2005; i++)
    {
        c[i][0] = 1;
        for (int j = 1; j < i+1; j++)
        {
            c[i][j] = (c[i-1][j] + c[i-1][j-1])%mod;
        }
        
    }
    
}

int main()
{
    init();
    int n, k;
    cin >> n>> k;
    for (int i = 1; i < k+1; i++)
    {
        cout << c[k-1][i-1]*c[n-k+1][i]%mod << endl;
    }
    
    return 0;
}


Measured memory_bytes: 30336
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;

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

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

struct pair_hash {
    size_t operator()(pair<int, int> x) const {
        return int_hash{}(x.first) ^ (int_hash{}(x.second) << 16);
    }
};

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e7;
const int MX = 100001; //check the limits, dummy

struct bit {
    vector<int> tree;
    bit(int size) : tree(size + 1, 0) {}

    int read(int x) {
        int ans = 0;
        while(x) {
            ans += tree[x];
            x -= (x & -x);
        }
        return ans;
    }

    void write(int x, int val) {
        while(x < tree.size()) {
            tree[x] += val;
            x += (x & -x);
        }
    }
};

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

    int n; cin >> n;
    string s; cin >> s;

    vector<bit> b(26, bit(n));
    for(int i = 0; i < s.size(); i++)
        b[s[i] - 'a'].write(i + 1, 1);

    int q; cin >> q;
    while(q--) {
        int type;
        cin >> type;

        if(type == 1) {
            int i; char c; cin >> i >> c;
            b[s[i - 1] - 'a'].write(i, -1);
            b[c - 'a'].write(i, 1);
            s[i - 1] = c;
        }
        else {
            int l, r; cin >> l >> r;
            int ans = 0;
            for(int i = 0; i < 26; i++)
                if(b[i].read(r) - b[i].read(l - 1)) ans++;
            cout << ans << endl;
        }
    }
}

Measured memory_bytes: 53660
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << x << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;

#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << x << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
map<int,int>mp;
int dp[200005];
int pre[200005];
int ans[200005];
int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    rep(i,n){
        dp[i] = 1;
        pre[i] = i;
        scanf("%d",&a[i]);
        if(mp.count(a[i]-1)){
            int k = mp[a[i]-1];
            dp[i] = dp[k]+1;
            pre[i] = k;
        }
        mp[a[i]] = i;
        //show(dp[i]);
    }
    int hoge = (int)(max_element(dp,dp+n)-dp);
    int k = dp[hoge];
    //cout << k << endl;
    /*rep(i,k){
        ans[i] = hoge+1;
        hoge = pre[hoge];
    }
    rep(i,k-1){
        cout << ans[k-1-i]<< " ";
    }
    cout << ans[0] << endl;*/
    cout << n-k << endl;
}

Measured memory_bytes: 12664
a=int(input())
if(400<=a<=599):
    b=8
if(600<=a<=799):
    b=7
if(800<=a<=999):
    b=6
if(1000<=a<=1199):
    b=5
if(1200<=a<=1399):
    b=4
if(1400<=a<=1599):
    b=3
if(1600<=a<=1799):
    b=2
if(1800<=a<=1999):
    b=1
print(b)

Measured memory_bytes: 9060
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 
#define dump(x)  cout << #x << " = " << (x) << endl;
typedef long long lint;
using namespace std;
int main(){
	lint a,b;
	cin>>a>>b;
	if((a+b)%2){
		cout<<"IMPOSSIBLE"<<endl;
	}else{
		cout<<(a+b)/2<<endl;
	}
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    char c;
    cin>>c;
    if((c=='a')||(c=='e')||(c=='i')||(c=='o')||(c=='u') )
    {
        cout<<"vowel";
    }
    else{
        cout<<"consonant";}
        return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <string.h>

#define BUF_SIZE 6

int N_all;

#define solb(i,j) SOLB[i*M_all+j]

int main(int argc, char* argv[]){
    int i,j,N_all;
    int temp,count;
    count=0;
    scanf("%d",&N_all);
    for(i=1;i<=N_all;i++){
        scanf("%d ",&temp);
        if(i % 2 == 1 && temp % 2 == 1){
            count++;
        }
    }
    printf("%d",count);
    return 0;
}

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

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    map<string, int> mp;
    for (int i = 1; i <= n; ++i) {
        string s;
        cin >> s;
        ++mp[s];
    }
    cout << "AC x " << mp["AC"] << '\n';
    cout << "WA x " << mp["WA"] << '\n';
    cout << "TLE x " << mp["TLE"] << '\n';
    cout << "RE x " << mp["RE"] << '\n';
}

Measured memory_bytes: 3664
#include <iostream>
    #include <string>
     
    using namespace std;
     
    int main() {
     
    string a;
    cin >> a;
    
    cout << a[0] << a[1] << a[2]<<a[3]<<" "<<a[4]<< a[5] << a[6] << a[7]<<a[8];
    cout << a[9] << a[10] << a[11]<<endl;
    
    return 0;
    }

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  
  for (int i = 0;i < s.size();i++){
    s[i] += n;
    if (s[i] > 'Z'){
      s[i] -= 26;
    }
  }
  
  cout << s << endl;
}

Measured memory_bytes: 3628
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef map<char,int> mci;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vii;
typedef vector<char> vc;
typedef vector<vc> vcc;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define F first
#define S second
#define in insert
#define mina(a,b) (a)=min((a),(b));
#define maxa(a,b) (a)=max((a),(b));
const int INF = 1e9 + 7;
void solve(){
    int a,b,c,d; cin>>a>>b>>c>>d;
    cout<<(a-c)*(b-d);
}
int main(){
    int T=1;
    //cin>>T;
    for(int i = 0; i < T; i++) solve(); 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu unsigned long long int
#define Endl endl
#define mod  998244353
#define mkp make_pair
#define pb push_back
#define cin(n) scanf("%d",&n)
#define cout(n) printf("%d ",n)
#define sf(n) scanf("%d",&n)
#define pf(n) printf("%d ",n)
#define bitget(n) __builtin_popcountll(n)
ll dx[] = {1,1,0,-1,-1,-1,0,1};
ll dy[] = {0,-1,-1,-1,0,1,1,1};
ll dxx[] = {1,-1,0,0};
ll dyy[] = {0,0,-1,1};
ll modexpo(ll x,ll y){if(y==0)return 1;if(y%2){ll viky=modexpo(x,y/2);
return (((x*viky)%mod)*viky)%mod;}else{ll viky=modexpo(x,y/2);return (viky*viky)%mod;
}}
bool isvalid(ll x,ll y,ll n, ll m) { return (x>=0&&x<n&&y>=0&&y<m); }



int main() {
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s;
    cin>>s;
    if(s=="Sunny"){
        cout<<"Cloudy";
    }else if(s=="Cloudy"){
        cout<<"Rainy";
    }else{
        cout<<"Sunny";
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vp;
typedef map<ll, ll> mll;
typedef map<string, ll> mstrll;
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
#define out(x) cout << (x)
#define indent() cout << '\n'
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
ll gcd(ll a, ll b){return b != 0 ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}
ll factorial(ll a){return a < 2 ? 1 : factorial(a - 1) * a;}
ll summation(ll a){return a < 1 ? 0 : (a * a + a) / 2;}
const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ll N = 200005;
const ll M = 100005;
const string ALPHABETS = "abcdefghijklmnopqrstuvwxyz";
ll dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};
//ll dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
ll n, m, x, y, z, w, h;
string s, t;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> n){
        ll ans = 1, tmp = 0, cnt = 0, mx = -INF, mn = INF;
        ll a[N] = {}, b[N] = {}, c[N] = {};
        vll v;
        cin >> a[0];
        rep(i, 1, n){
            cin >> a[i];
            if(a[i] == a[i - 1]){
                continue;
            }else if(cnt && (cnt == 1 && a[i] < a[i - 1] || cnt == -1 && a[i] > a[i - 1])){
                ans++;
                cnt = 0;
            }else{
                cnt = a[i] > a[i - 1] ? 1 : -1;
            }
        }
        print(ans);
    }
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int mp[30][30] = {0};
int main() {
  while (true) {
    string s;
    cin >> s;
    if (s == "#")
      break;
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    a--;
    b--;
    c--;
    d--;
    int w, h;
    int i = 0, j = 0, k = 0;
    while (k < s.size()) {
      if (s[k] == 'b') {
        mp[i][j] = 1;
        j++;
        k++;
      } else if (s[k] == '/') {
        j = 0;
        i++;
        k++;
      } else {
        mp[i][j] = 0;
        j++;
        s[k]--;
      }
      if (s[k] == '0') {
        k++;
      }
    }
    w = j;
    h = i + 1;
    mp[a][b] = 0;
    mp[c][d] = 1;
    string t;
    for (int i = 0; i < h; i++) {
      bool r = false;
      for (int j = 0; j < w; j++) {
        if (!mp[i][j]) {
          if (r) {
            t[t.size() - 1]++;
          } else {
            r = true;
            t.push_back('1');
          }
        } else {
          r = false;
          t.push_back('b');
        }
      }
      if (i < h - 1)
        t.push_back('/');
    }
    cout << t << endl;
  }
  return 0;
}


Measured memory_bytes: 3180
import numpy as np

N, K = map(int, input().split())
A = np.array([int(i) for i in input().split()])
A.sort()

A_max = max(np.abs(A))
A_minus = A[A<0]
A_zero = A[A==0]
A_plus = A[A>0]

def check(x):
    ret = 0
    if x >= 0:
        ret += N * len(A_zero)
    ret += np.searchsorted(A, x // A_plus, side='right').sum()
    ret += (N - np.searchsorted(A, -(x // -A_minus))).sum()
    ret -= np.count_nonzero(A * A <= x)
    return ret // 2

right = A_max * A_max
left = -right - 1
while (right - left > 1):
    middle = (right + left) >> 1
    if check(middle) < K:
        left = middle
    else:
        right = middle
print(right)

Measured memory_bytes: 32256
#include<iostream>
#include<iomanip>

using namespace std;

int main(void)
{
	while(1)
	{
		double a,ans;
		if(!(cin>>a))break;
		ans=a;
		for(int i=1;i<10;i++)
		{
			if(i%2==1)
			{
				a*=2;
			}
			else
			{
				a/=3;
			}
			ans+=a;
		}
		cout<<fixed<<setprecision(8)<<ans<<endl;
	}
}

Measured memory_bytes: 1272
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a[] = new int[5];
            for (int i = 0; i < 5; i++) {
                a[i] = sc.nextInt();
                if (a[i] < 40) {
                    a[i] = 40;
                }
            }
        int sum=0;
            for (int i = 0; i < 5; i++) {
                sum +=a[i];
            }
        System.out.println(sum/5);
        }
    }

Measured memory_bytes: 17176
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
vector<int>pat[100000];
int col[100000];
typedef long long ll;
bool fl;
void dfs(int node, int c)
{
	if (col[node] != 0)
	{
		if (col[node] != c)fl = false;
		return;
	}
	col[node] = c;
	for (int i = 0; i < pat[node].size(); i++)dfs(pat[node][i], -c);
}
int main()
{
	int num, way;
	scanf("%d%d", &num, &way);
	for (int i = 0; i < way; i++)
	{
		int za, zb;
		scanf("%d%d", &za, &zb);
		za--, zb--;
		pat[za].push_back(zb);
		pat[zb].push_back(za);
	}
	ll c1 = 0, c2 = 0, c3 = 0;
	for (int i = 0; i < num; i++)
	{
		if (col[i] == 0)
		{
			if (pat[i].size() == 0)c1++;
			else
			{
				fl = true;
				dfs(i, 1);
				if (fl)c2++;
				else c3++;
			}
		}
	}
	printf("%lld\n", c2*c2 * 2 + c2*c3 * 2 + c3*c3 + c1 * 2 * num - c1*c1);
}

Measured memory_bytes: 9984
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
#include<map>
typedef long long ll; 
using namespace std;
/*
time:
wa:
反省:
考察・解説:
*/
int main() {
    vector<ll>a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin(), a.end());

    for(int i = 0; i < 3; i++){
        if(a[i] % 2 == 0){
            cout << '0' << endl;
            return 0;
        }
    }
    ll s = a[0]*a[1];
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3608
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.math;
import std.regex;

void main() {
	auto N = readln.chomp.to!int;
	auto K = readln.chomp.to!int;
	int res;
	foreach(x_i; readln.split.to!(int[])) {
		res += min(abs(K - x_i), x_i)*2;
	}
	writeln(res);
}

Measured memory_bytes: 256
# 2019-11-26 17:11:55(JST)
import sys
from string import ascii_lowercase as alph
ind_alph = dict((char, ind) for ind, char in enumerate(alph))

def main():
    s, k = sys.stdin.read().split()
    s = list(s)
    k = int(k)
    n = len(s)

    i = 0
    while k:
        j = ind_alph[s[i]]
        diff = (26 - j) % 26
        if diff <= k:
            s[i] = 'a'
            k -= diff
        if i == n - 1 and k:
                s[i] = alph[(ind_alph[s[i]] + k) % 26]
                k = 0
        i += 1

    print(''.join(s))

if __name__ == '__main__':
    main()


Measured memory_bytes: 4664
#include<cstdio>
using namespace std;
const int MAX = 1200000;
bool prime[MAX];
int solve(int n){
  int cnt = 1;
  if(n == 1)
    return 0;
  else if(n == 2)
    return 1;
  else{
    for(int i = 3 ; i <= n ; i++){
      if(prime[i])
        cnt++;
    }
  }
  return cnt;
}
int main(){
  for(int i = 0 ; i < MAX ; i++)
    prime[i] = true;
  prime[0] = prime[1] = false;
  for(int i = 4 ; i < MAX ; i += 2)
    prime[i] = false;
  for(int i = 3 ; i < MAX ; i += 2){
    if(prime[i]){
      for(int j = i * 2 ; j < MAX ; j += i)
        prime[j] = false;
    }
  }
  int n;
  while(scanf("%d",&n) != EOF){
    printf("%d\n",solve(n));
  }
}




Measured memory_bytes: 3788
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n-1); i >= 0; i--)
using namespace std;
typedef long long ll;
//const int MOD = 1000000007;
const ll INF = 1LL<<60;
const int IINF = 1000000000;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int MOD = 998244353;

struct mint {
    ll x;
    mint(ll x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    bool operator==(const mint a){
        return (x == a.x);
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// 2項係数を求める
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

//nが非常に大きく、aが小さい場合
mint choose(int n, int a){
    mint x = 1, y = 1;
    rep(i,a){
        x *= n-i;
        y *= i+1;
    }
    return x/y;
}
int main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N, M, K; cin >> N >> M >> K;

    combination c(N+1);
    mint ans = 0;
    mint color_pattern = M;
    for(int x = N-1; x >= 0; --x){
        mint now = color_pattern;
        now *= c(N-1,x);
        if (x <= K) ans += now;
        color_pattern *= (M-1);
    }
    cout << ans << endl;
}

Measured memory_bytes: 6348
from decimal import Decimal as D
a,s,d,f=map(D,input().split())
h=[d-a,f-s]
leh=((d-a)**2+(f-s)**2)**(D("0.5"))
for i in range(int(input())):
    x,y=map(D,input().split())
    co=(x-a)*h[0]/leh+(y-s)*h[1]/leh
    print(a+h[0]*co/leh,s+h[1]*co/leh)


Measured memory_bytes: 6436
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<climits>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

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


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const int INF = INT32_MAX / 3;
const ll MOD = 1e9 + 7;

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


/******************************************************************************************/



//ユークリッド互除法
template<typename T>
T gcd(T x, T y) {

	if (y == 0) {
		return x;
	}
	else {
		return gcd(y, x % y);
	}
}

/*最小公倍数*/
template<typename T>
T lcm(T x, T y) {
	T tmp = gcd(x, y);
	return x * y / tmp;
}


int main() {


	string s[10];
	s[0] = "SUN";
	s[1] = "MON";
	s[2] = "TUE";
	s[3] = "WED";
	s[4] = "THU";
	s[5] = "FRI";
	s[6] = "SAT";
	string t;
	cin >> t;
	for (int i = 0; i < 7; i++)
	{
		if (t == s[i]) {
			cout << (7 - i) << endl;
			return 0;
		}

	}

	
	


	return 0;
}


Measured memory_bytes: 256
#include <climits>
#include <cmath>
#include <algorithm>
#include <array>
#include <iostream>
#include <vector>
using namespace std;
int main(int, char**)
{
	int N;
	cin >> N;
	vector<double> v(N);
	for (int i = 0; i < N; ++i)
	{
		cin >> v[i];
	}
	sort(v.begin(), v.end());
	double result = v[0];
	for (int i = 1; i < N; ++i)
	{
		result += v[i];
		result /= 2;
	}
	cout << result << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>


#define REP(i,N) for(auto i = 0; i <N; i++)


typedef long long ll;
//const int MOD = pow(10,9)+7;
//const int MAX = 100001;

using namespace std;
int in(){
    int temp;
    scanf("%d",&temp);
    return temp;
}

ll lin(){
    ll temp;
    scanf("%lld",&temp);
    return temp;
}


int main() {
    
    int N = in();
   
    set<int> st;
    
    int temp;
    for(auto i = 0; i<N; i++){
        
        temp = in();
        
        if (st.find(temp) == st.end()){
            st.insert(temp);
        }else{
            st.erase(st.find(temp));
        }
        
    }
    
    
    cout << st.size() << endl;
    return 0;
    
    
}



Measured memory_bytes: 4864
#include <stdio.h>
#include <algorithm>
using namespace std;

const int N = 3e3+10;
int n;
double DP[N][N];
double T[N];

int main(){
  scanf("%d",&n);
  for(int i=1; i<=n; i++)scanf("%lf",&T[i]);
  DP[1][0] = 1 - T[1];
  DP[1][1] = T[1];
  for(int i=2; i<=n; i++){
    for(int j=0; j<=i; j++){
      DP[i][j] = DP[i-1][j] * (1-T[i]);
      if(j)DP[i][j] += DP[i-1][j-1] * T[i];
    }
  }

  double res = 0;
  for(int i=n; i>n/2; i--){
    res += DP[n][i];
  }
  printf("%.9lf\n",res);

  return 0;
}


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

int main(){

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

  vector<vector<int>> ABC(N,vector<int>(3,0));
  vector<char> S(N);
  bool ans = 1;

  for(int i=0;i<N;i++){
    string str;
    cin >> str;

    if(str=="AB"){
      ABC[i][0]=1;
      ABC[i][1]=1;
    }
    else if(str=="AC"){
      ABC[i][0]=1;
      ABC[i][2]=1;
    }
    else if(str=="BC"){
      ABC[i][1]=1;
      ABC[i][2]=1;
    }
  }


  for(int i=0;i<N;i++){
    if(ABC[i][0]==1 && ABC[i][1]==1 && ABC[i][2]==0){
      if(A==0 && B==0){
        ans = 0;
        break;
      }else if(A==0){
        S[i]='A';
        A++;
        B--;
      }else if(B==0){
        S[i]='B';
        B++;
        A--;
      }else{
        if(i!=N-1){
          if(ABC[i+1][0]==1){
            S[i]='A';
            A++;
            B--;
          }else if(ABC[i+1][1]==1){
            S[i]='B';
            B++;
            A--;
          }
        }else{
          S[i]='A';
          A++;
          B--;
        }
      }
    }else if(ABC[i][0]==1 && ABC[i][1]==0 && ABC[i][2]==1){
      if(A==0 && C==0){
        ans = 0;
        break;
      }else if(A==0){
        S[i]='A';
        A++;
        C--;
      }else if(C==0){
        S[i]='C';
        C++;
        A--;
      }else{
        if(i!=N-1){
          if(ABC[i+1][0]==1){
            S[i]='A';
            A++;
            C--;
          }else if(ABC[i+1][2]==1){
            S[i]='C';
            C++;
            A--;
          }
        }else{
          S[i]='A';
          A++;
          C--;
        }
      }
    }else if(ABC[i][0]==0 && ABC[i][1]==1 && ABC[i][2]==1){
      if(B==0 && C==0){
        ans = 0;
        break;
      }else if(B==0){
        S[i]='B';
        B++;
        C--;
      }else if(C==0){
        S[i]='C';
        C++;
        B--;
      }else{
        if(i!=N-1){
          if(ABC[i+1][1]==1){
            S[i]='B';
            B++;
            C--;
          }else if(ABC[i+1][2]==1){
            S[i]='C';
            C++;
            B--;
          }
        }else{
          S[i]='B';
          B++;
          C--;
        }
      }
    }
    if(ans==0) break;
  }

  if(ans==0) cout << "No" << endl;
  else{
    cout << "Yes" << endl;
    for(int i=0;i<N;i++){
      cout << S[i] << endl;
    }
  }
}

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

int main(){
  int a,b;

  while(1){
    cin >> a >> b;
    if(a==0 && b==0) break;
    else{
      if(a > b)
        cout << b << " " << a << endl;
      else
        cout << a << " " << b << endl;
    }
  }

  return 0;
}

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

using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

const int N = 605;
bool dp[N][N][N];
string s[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.setf(cout.fixed);
    cout.precision(20);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s[i];
        s[i] += s[i];
        s[i].pop_back();
        reverse(s[i].begin(), s[i].end());
    }
    for (int i = n; i < n + n - 1; i++) {
        s[i] = s[i - n];
    }
    for (int i = 0; i < n + n - 1; i++) {
        for (int j = 0; j < n + n - 1; j++) {
            dp[i][j][0] = true;
        }
    }
    for (int k = 1; k < n; k++) {
        for (int i = 0; i + k < n + n - 1; i++) {
            for (int j = 0; j + k < n + n - 1; j++) {
                dp[i][j][k] = dp[i + 1][j][k - 1] && dp[i][j + 1][k - 1] && s[i][j] == s[i + k][j + k];
            }
        }
    }
    int res = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            res += dp[i][j][n - 1];
        }
    }
    cout << res << "\n";
}


Measured memory_bytes: 215680
#![allow(unused_imports)]

use std::{i32, i64, u32, u64, usize, f64};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::io::{stdout, Write, BufWriter};
use std::mem::{swap};
use maplit::*;
use proconio::{input, marker::{Isize1, Usize1, Bytes, Chars}};

#[proconio::fastout]
fn main() {
    input!(
        x: i64,
        y: i64,
    );
    let (a, b) = (x.abs(), y.abs());
    let z = x * y;
    if a < b {
        let t = {
            if 0 <= x && 0 < y { 0 }
            else if z <= 0 { 1 }
            else { 2 }
        };
        println!("{}", b - a + t);
    } else if a == b { println!("{}", if z < 0 { 1 } else { 0 }); }
    else {
        let t = {
            if y <= 0 && x < 0 { 0 }
            else if z <= 0 { 1 }
            else { 2 }
        };
        println!("{}", a - b + t);
    }
}


Measured memory_bytes: 2124
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		int home[][][] = new int[4][3][10];

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for (int i=1; i<=n; i++){
			int b = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			int v = sc.nextInt();
			home[b-1][f-1][r-1] += v;
		}
		for (int j=0; j<=4-1; j++){
			for(int k=0; k<=3-1; k++){
				String line = "";
				for(int l=0; l<=10-1; l++){
					line += " "+home[j][k][l];
				}
				System.out.println(line);
			}
			if(j!=3){System.out.println("####################");}
		}
	}
}



Measured memory_bytes: 29692
N, K = map(int, input().split())
p_list = list(map(int, input().split()))

p_list_E = []
p_list_E_temp = [1, 1.5, 2, 2.5, 3, 3.5]

for i in range(len(p_list)):
    p_list_E.append((p_list[i]+1)*0.5)
#print(p_list_E)

p_list_sum = [0]
for i in range(0,N):
    p_list_sum.append(p_list_sum[i]+p_list_E[i])
#print(p_list_sum)

ans = 0
for i in range(K,N+1):
    ans = max(ans, p_list_sum[i]-p_list_sum[i-K])
print(ans)

Measured memory_bytes: 33420
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        string s = Console.ReadLine();
        string t = Console.ReadLine();
        for (int i = 0; i < s.Length; i++) {
            string rotatedS = s.Substring(i) + s.Substring(0, i);
            if(rotatedS == t)
            {
                Console.WriteLine("Yes");
                return;
            }
        }
        Console.WriteLine("No");
    }
}


Measured memory_bytes: 11092
N, X = map(int, input().split())

lst = [1]

for _ in range(1,N+1):
  lst.append(2*lst[-1]+1)

pw = 2**(N+1)-3
rlt = 0
i = N-1
while 1:
  if X == 1:
    print(rlt)
    exit()
  elif X < pw+2:
    X -= 1
    pw = (pw-3)//2
    if i > 0: 
      i -= 1
    elif i == 0:
      print(rlt+1)
      exit()
  elif X == pw+2:
    rlt += lst[i]+1
    print(rlt)
    exit()
  elif X < 2*pw+3:
    X -= pw + 2
    pw = (pw-3)//2
    if i > 0:
      rlt += lst[i]+1
      i -= 1
    elif i == 0:
      print(rlt+3)
      exit()
  elif X == 2*pw+3:
    rlt += 2*lst[i]+1
    print(rlt)
    exit()

Measured memory_bytes: 61860
#include <iostream>
#include <vector>
#include <algorithm>

int n, k;
std::vector<int> vec;
int c = 0;
int ind = 0;

int main() {
    std::cin >> n >> k;
    if (n == k) {
        std::cout << "1" << std::endl;
        return 0;
    }
    vec.assign(n, 0);
    for (int i = 1; i <= n; i++) {
        std::cin >> vec[i];
    }
    c = 0;
    while (ind < n) {
        ind+=k;
        c++;
        if (ind >= n) {
            std::cout << c << std::endl;
            return 0;
        }
        ind--;
    }
}


Measured memory_bytes: 640
N = int(input())
A_dic = {}
A_lis = [int(x) for x in input().split()]
sum = 0

for n in range(N):
    if A_lis[n] in A_dic.keys():
        A_dic[A_lis[n]] += 1
    else:
        A_dic[A_lis[n]] = 1


for key,val in A_dic.items():
    sum += val*(val-1)

sum = sum//2



for n in range(N):
    print(sum - (A_dic[A_lis[n]] - 1))

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int N, M, X; cin >> N >> M >> X;
    vi A(M+1); REP1(i, M) cin >> A[i];
    int cost1 = 0, cost2 = 0;
    for(int i = X+1; i <= N; i++)
    {
        for(int j = 1; j <= M; j++)
        {
            if(A[j] == i) cost1++;
        }
    }
    for(int i = 0; i < X; i++)
    {
        for(int j = 1; j <= M; j++)
        {
            if(A[j] == i) cost2++;
        }
    }

    cout << min(cost1, cost2) << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    // Your code here!
int a, b, d, r; 
    double f; 
     scanf("%d %d", &a, &b); 
     d=a/b; 
     r=a%b; 
     f=(double)a/(double)b; 
     printf("%d %d %f\n", d, r, f); 

 return 0;
}


Measured memory_bytes: 2104
import numpy as np

n,m,c=map(int,input().split())
b=list(map(int,input().split()))
a=[]
for i in range(n):
    l=list(map(int,input().split()))
    a.append(l)

b=np.array(b).reshape(m,1)
a=np.array(a)

ab=np.dot(a,b)

ans=0
for i in range(n):
    if ab[i]+c>0:
        ans+=1

print(ans)

Measured memory_bytes: 27280
a = input()
b = input()
c = input()

la = len(a)
lb = len(b)
lc = len(c)

AB = [False]*la
AC = [False]*la
BA = [False]*lb
BC = [False]*lb
CA = [False]*lc
CB = [False]*lc
for i in range(la):
    for s,t in zip(a[i:],b):
        if not(s=='?' or t=='?' or s==t):
            break
    else:
        AB[i] = True
for i in range(la):
    for s,t in zip(a[i:],c):
        if not(s=='?' or t=='?' or s==t):
            break
    else:
        AC[i] = True
for i in range(lb):
    for s,t in zip(b[i:],a):
        if not(s=='?' or t=='?' or s==t):
            break
    else:
        BA[i] = True
for i in range(lb):
    for s,t in zip(b[i:],c):
        if not(s=='?' or t=='?' or s==t):
            break
    else:
        BC[i] = True
for i in range(lc):
    for s,t in zip(c[i:],a):
        if not(s=='?' or t=='?' or s==t):
            break
    else:
        CA[i] = True
for i in range(lc):
    for s,t in zip(c[i:],b):
        if not(s=='?' or t=='?' or s==t):
            break
    else:
        CB[i] = True

ans = la+lb+lc
for i in range(-(lb+lc),la+max(lb,lc)+1):
    if 0<=i<la:
        ab = AB[i]
    elif -lb<i<0:
        ab = BA[-i]
    else:
        ab = True
    if not ab: continue
    l = min(0,i)
    r = max(la,i+lb)
    if ans <= r-l : continue
    for j in range(-(lb+lc),la+max(lb,lc)+1):
        
        
        if 0<=j<la:
            ac = AC[j]
        elif -lc<j<0:
            ac = CA[-j]
        else:
            ac = True
            
        k = j-i
        if 0<=k<lb:
            bc = BC[k]
        elif -lc<k<0:
            bc = CB[-k]
        else:
            bc = True
        
        if ab and ac and bc:
            l = min(0,i,j)
            r = max(la,i+lb,j+lc)
            ans = min(ans,r-l)
print(ans)

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

int main(){
    int a,b,c;
    int i;
    int d;
    cin >> a >> b >> c;
    d = a;
    for(int j = 0; j < (b - a) + 1; j++){
        if(c % d == 0)
            i++;
        d++;
    }
    cout << i << endl;
    
    return 0;
}


Measured memory_bytes: 3112
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

H, W, K = map(int, input().split())
S = [input() for _ in range(H)]
mi = None

def _max(iterable):
    ma = 0
    for i in iterable:
        ma = max(ma, i)
    return ma

for i in range(2 ** (H - 1)):
    # div[j] is true if row j and row j + 1 is divided
    div = [(i & (1 << j)) > 0 for j in range(H - 1)]
    group = [0] * H
    for j in range(H - 1):
        group[j + 1] = group[j] + 1 if div[j] else group[j]
    count = Counter()
    ans = div.count(True)
    ok = True
    for j in range(W):
        tmp = Counter()
        for k in range(H):
            if S[k][j] == '1':
                tmp[group[k]] += 1
        if _max(tmp.values()) > K:
            ok = False
        elif _max((tmp + count).values()) <= K:
            count += tmp
        else:
            count = tmp
            ans += 1
    if ok and (mi is None or ans < mi):
        mi = ans

print(mi)


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

#define fl(k, n) for(int i = k; i < n; i++)
#define flr(k, n) for(int i = n - 1; i >= k; i--)
#define vi vector<int>
#define vp vector<pair<int, int>>
#define mp make_pair
#define ll long long

using namespace std;

int binary_search(vector<int> nums, int target_val){
  int begin = 0;
  int end = nums.size();
  int mid;

  while(begin <= end){
    mid = begin + (end - begin) / 2;
    if(nums[mid] == target_val)
      return mid;
    else if(nums[mid] <= target_val && nums[mid + 1] > target_val)
      return mid;
    else if(nums[mid] > target_val)
      end = mid - 1;
    else
      begin = mid + 1;
  }

  if(begin == 0)
    return -1;
  else 
    return nums.size();
}

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

  int n;
  cin >> n;

  vi heights(n);
  fl(0, n)
    cin >> heights[i];

  vi costs(n);
  costs[0] = 0;
  costs[1] = abs(heights[1] - heights[0]);

  fl(2, n){
    int costj2 = costs[i - 2] + abs(heights[i] - heights[i - 2]);
    int costj1 = costs[i - 1] + abs(heights[i] - heights[i - 1]);
    costs[i] = min(costj2, costj1);
  }

  cout << costs[n - 1] << "\n";

}

Measured memory_bytes: 3920
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include<numeric>
#include<cmath>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using vvii = vector<vector<int> >;
using vvll =  vector<vector<ll> >;
const ll mod = 1e9 + 7;

const ll inf = 1LL << 60;

struct mint{
    ll x;
    mint(ll x = 0): x((x % mod + mod)%mod){}

    
    mint& operator+=(const mint a){
        if((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a){
        if((x += mod-a.x) >= mod)  x -= mod;
        return *this;
    }
    mint& operator*=(const mint a){
        (x *= a.x) %= mod;
        return *this;
    }
    
    mint operator+(const mint a) const{ //クラスのメンバを変更しない
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const{ //クラスのメンバを変更しない
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const{ //クラスのメンバを変更しない
        mint res(*this);
        return res*=a;
    }

    mint pow(ll n)const{
        if(n == 0)return 1;
        mint a = pow(n>>1);
        a *= a;
        if(n & 1)a *= (*this);
        return a;
    }

    mint inv() const{
        return pow(mod-2);
    }
    mint& operator/=(const mint a){
        return (*this) *= a.inv();
    }
    mint operator/(const mint a)const{
        mint res(*this);
        return res/=a;
    }
    
};

ostream& operator<<(ostream &os, const mint &m){
    os << m.x;
    return os;
}

struct Combination{
    vector<mint> fact,ifact;
    Combination(int n): fact(n+1),ifact(n+1){
        fact[0] = 1;
        for(int i = 1; i<=n; i++)fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for(int i = n; i>= 1; i--){
            ifact[i-1] = ifact[i] * i;
        }
    }

    mint comb(int n, int k){
        if(k < 0 || n < k)return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

int main(){
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
    ll K; cin>>K;
    string S; cin>> S;
    ll num = S.length();
    mint ans = 0;
    mint a = 25;
    mint b = 26;
    Combination Comb(num+K+5);
    for(ll j = num; j <= num + K; j++){
        mint now = Comb.comb(j-1, num-1) * a.pow(j - num) * b.pow(num + K - j);
        ans += now;
    }

    cout << ans << endl;
}

Measured memory_bytes: 35648