akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    string s;
    cin>>s;
    long long A[200001],dp[200000][13]={0},mod=1e9+7,M[200001];
    rep(i,s.size()){
        if(s[i]=='?') A[i]=-1;
        else A[i]=s[i]-'0';
    }
    rep(i,s.size()){
        if(i==0) M[i]=1;
        else M[i]=(M[i-1]*10)%13;
    }
    reverse(A,A+s.size());
    dp[0][0]=1;
    rep(i,s.size())rep(j,13){
        if(A[i]==-1) rep(k,10) dp[i+1][(j+k*M[i])%13]+=dp[i][j]%mod;
        else dp[i+1][(j+A[i]*M[i])%13]+=dp[i][j]%mod;
    }
    cout<<dp[s.size()][5]%mod<<endl;
}

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

int main(void)
{
    string x;
    cin>>x;
    reverse(x.begin(),x.end());
    string y;
    int pos1,pos2,pos3,pos4;
    do
    {
        y=x.substr(0,7);
        pos1=y.find("remaerd",0);
        if(pos1!=-1)
        {
            x.erase(0,7);
            continue;
        }
        pos2=y.find("maerd",0);
        if(pos2!=-1)
        {
            x.erase(0,5);
            continue;
        }
        pos3=y.find("resare",0);
        if(pos3!=-1)
        {
            x.erase(0,6);
            continue;
        }
        pos4=y.find("esare",0);
        if(pos4!=-1)
        {
            x.erase(0,5);
            continue;
        }
    }while(x.size()!=0&&(pos1!=-1||pos2!=-1||pos3!=-1||pos4!=-1));
    if(x.size()==0)
    {
        cout <<"YES"<<endl;
    }
    else
    {
        cout <<"NO"<<endl;
    }
    return 0;
}


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

const i64 MOD = 1e9 + 7;

i64 modpow(i64 a, i64 n)
{
  i64 res = 1;
  while (n > 0)
  {
    if (n & 1)
      res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return res;
}

i64 modinv(i64 a)
{
  i64 b = MOD, u = 1, v = 0;
  while (b)
  {
    i64 t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= MOD;
  if (u < 0)
    u += MOD;
  return u;
}

i64 nCr(i64 n, i64 r)
{
  i64 den = 1, mol = 1;
  for (i64 i = n; i > n - r; i--)
    (den *= i) %= MOD;
  for (i64 i = 1; i < r + 1; i++)
    (mol *= i) %= MOD;
  return den * modinv(mol) % MOD;
}

int main()
{
  i64 n, a, b;
  cin >> n >> a >> b;
  cout << (modpow(2, n) - 1 - nCr(n, a) - nCr(n, b) + 3 * MOD) % MOD << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 0xffffffff
#define pb push_back

using namespace std;

typedef long long ll;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int n, k, x, y;
    ll answer;
    
    cin >> n;
    cin >> k;
    cin >> x;
    cin >> y;
    
    if(n > k){
        answer = (x*k) + (y*(n - k));
    }else{
        answer = x*n;
    }
    
    cout << answer << endl;
    
    
    return 0;
}

Measured memory_bytes: 3660
using System;

public class Hello
{
    public static void Main()
    {
        
string[] str = Console.ReadLine().Split();
   int a=int.Parse(str[0]);
    int b=int.Parse(str[1]);

int s,i;
    s=a*b;
    i=2*a+2*b;
    
    
    Console.WriteLine("{0} {1}",s,i);
    
    
    }
}




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

int dp[1400][1400];
int f[1400][1400];
int main() {
	int h, w; scanf("%d%d", &h, &w);
	rep(i, h)rep(j, w)scanf("%d", &f[i][j]);
	int Max = 0;
	rep(i, h)rep(j, w){
		if (!f[i][j]) {
			dp[i][j] = 1;
			Max = 1;
		}
	}
	for (int i = 1; i < h; i++)for (int j = 1; j < w; j++) {
		if (f[i][j])continue;
		dp[i][j] = min(dp[i - 1][j - 1], min(dp[i - 1][j], dp[i][j - 1])) + 1;
		Max = max(Max, dp[i][j]);
	}
	printf("%d\n", Max*Max);
}

Measured memory_bytes: 16336
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
void print(vector<vector<int> > dp){
  cout << "---------------" << endl;
  for(int i = 0;i  < dp.size();i++){
	for(int j = 0;j < dp.size();j++){
	  cout << dp[i][j] << " ";
	}
	cout << endl;
  }
}
int cal(vector<pair<int,int> > vec){
  vector<vector<int> > dp(vec.size(),vector<int>(vec.size(),0));  
  for(int i = 0;i < vec.size()-1;i++){
	for(int j = 0;j < vec.size();j++){
	  for(int k = j+1;k < vec.size();k++){
		if(vec[j].first > vec[k].first && vec[j].second > vec[k].second){
		  dp[i+1][k] = max(dp[i][j]+1,dp[i+1][k]);

		}
	  }
	}
  }
  int ans = 0;
  for(int i = 0;i < vec.size();i++){
	ans = max(ans,dp[vec.size()-1][i]);
  }
  return ans;
}
void print2(vector<int> vec){
  for(int i = 0;i < vec.size();i++)
	cout << vec[i] << " ";
  cout << endl;

}
int cal2(vector<pair<int,int> > vec){
  vector<int> dp(vec.size(),0);
  for(int i = 0;i < vec.size();i++){
	for(int j =i+1;j < vec.size();j++){
	  if(vec[i].first > vec[j].first && vec[i].second > vec[j].second){
		dp[j] = max(dp[i]+1,dp[j]);
	  }
	}
//	print2(dp);
  }
  int ans = 0;
  for(int i = 0;i < dp.size();i++){
	ans = max(ans,dp[i]);
  }
  return ans;
}
int main(){
  int n;

  while(cin >> n && n!=0){
	vector<pair<int,int> > vec;
	vec.emplace_back(10000,10000);
	for(int i = 0;i < n;i++){
	  int h,r;
	  cin >> h >> r;
	  vec.emplace_back(h,r);  
	}
	cin >> n;
	for(int i = 0;i < n;i++){
	  int h,r;
	  cin >> h >> r;
	  vec.emplace_back(h,r);
	}
	sort(vec.begin(),vec.end(),greater<pair<int,int> >());
	cout << cal(vec) << endl;
//	cout << cnt << endl;
  }
  return 0;
}

Measured memory_bytes: 1348
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int l[111111];
int main(void){
  int m;
  cin >> m;
  for(int j = 0; j < m; j++){
    int n,k,b;
    cin >> n >> k;
    cin >> b;
    for(int i = 0; i < n-1; i++){
      int a;
      cin >> a;
      l[i] = a-b;
      b = a;
    }
    sort(l,l+n-1);
    int res = 0;
    for(int i = 0; i < n-k; i++){
      res += l[i];
    }
    cout << res << endl;
  }
}

Measured memory_bytes: 1568
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <bitset>
#include <numeric>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <numeric>
#include <cstdlib>
#include <random>
#include <bits/stdc++.h>


using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll mod=1000000007ll;
const ll inf=1000000000000000ll;

const ll MAX_N=1000;

ll N,pn;

map<ll,ll> mp;

void solve_mp(ll pn){
  for(ll i=2;i<=ceil(sqrt(pn));i++){
    while(pn%i==0){
      mp[i]++;
      pn/=i;
    }
  }
  if(pn!=1)mp[pn]++;
}

int main(){
  cin>>N>>pn;
  solve_mp(pn);
  ll ans=1;
  for(auto itr=mp.begin();itr != mp.end(); ++itr){
//    cout<<itr->first<<", "<<itr->second<<", "<<(ll)(itr->second/N)<<endl;
    if(floor(itr->second/N)>=1) ans*=pow(itr->first , floor(itr->second/N));
  }
  cout<<ans<<endl;
  return 0;
}


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


signed main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int mx = 0;
  rep(i,n) mx = max(mx, a[i]);

  vector<int> c(mx+1);
  rep(i,n) {
    for(int j=1; j * a[i] <= mx; j++) {
      c[j*a[i]]++;
    }
  }
  int ans = 0;
  rep(i,n) ans += (c[a[i]]==1);
  cout << ans << endl;
}


Measured memory_bytes: 7976
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const int MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    V<int> a(n);
    for (int i = 0; i < n; i++) {
        char c; cin >> c;
        a[i] = c - '0' - 1;
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        int comb = 1;
        int tmpn = n - 1, tmpk = i;
        while (tmpn > 0 || tmpk > 0) {
            int nb = tmpn & 1, kb = tmpk & 1;
            tmpn >>= 1, tmpk >>= 1;
            if (nb == 0 && kb == 1) {
                comb *= 0;
            } else {
                comb *= 1;
            }
        }
        ans ^= (a[i] & 1) * comb;
    }

    if (ans & 1) {
        cout << 1 << '\n';
    } else {
        for (int i = 0; i < n; i++) {
            if (a[i] == 1) {
                cout << 0 << '\n';
                return 0;
            }
        }

        for (int i = 0; i < n; i++) a[i] >>= 1;

        ans = 0;
        for (int i = 0; i < n; i++) {
            int comb = 1;
            int tmpn = n - 1, tmpk = i;
            while (tmpn > 0 || tmpk > 0) {
                int nb = tmpn & 1, kb = tmpk & 1;
                tmpn >>= 1, tmpk >>= 1;
                if (nb == 0 && kb == 1) {
                    comb *= 0;
                } else {
                    comb *= 1;
                }
            }
            ans ^= (a[i] & 1) * comb;
        }

        if (ans & 1) cout << 2 << '\n';
        else cout << 0 << '\n';
    }
    return 0;
}


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

int main(void){
    string s;
    cin>>s;
    string A[4]={"A","C","G","T"};
    ll c=0,ans=0;
    
    rep(0,i,s.length()){
        string s0=s.substr(i,1);
        //cout<<s0<<endl;
        rep(0,j,4){
            if(s0==A[j]){
                ++c;
                break;
            }
            if(j==3){
                ans=max(ans,c);
                c=0;
            }
        }
    }
    ans=max(ans,c);
    cout<<ans<<endl;
}


Measured memory_bytes: 256
let s = Int(readLine()!)!

var arr:Array<Int> = [s]
var a=s
var new:Int
var i=1

while true{
  i+=1
  if a%2==0{
    new=a/2
  }else{
    new=3*a+1
  }
  
  if arr.contains(new){
    break
  }else{
    arr.append(new)
    a=new
  }
}

print(i)


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

int main(){
  string s;
  cin >>s;
  for(int i=0;i<s.size();i++){
    if(s[i] == '1') cout << 9;
    else if(s[i] == '9') cout << 1;
    else cout << s[i];
  }
  cout << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>

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

using namespace std;

#define min_3(a, b, c) min(a, min(b, c))
#define max_3(a, b, c) max(a, max(b, c))
typedef long long ll;

int main()
{
    int r; cin >> r;
    cout << 3 * r * r << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <math.h>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}*/

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

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

	int ans = 0;

	typedef map<int, int> M; // map<key の型, valueの型>
	M ma;

	rep(i, n) {
		ma[a[i]]++;
	}

	for (auto m : ma) {
		if (m.first != m.second) {
			if (m.first > m.second) {
				ans += m.second;
			}
			else {
				ans += m.second - m.first;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
#define int long long
#define for0(i, n) for(int i = 0; i < (n); i++)
using namespace std;
int n, s;
int sum = 0;
bool b[20];
int f(int k) {
	if (sum + 9 * k * (k + 1) / 2 < s)return 0;
	int r = 0;
	if (k == 0) return s == sum;
	for0(i, 10) {
		if (sum + i * k > s)break;
		if (b[i])continue;
		b[i] = 1; sum += k * i;
		r += f(k - 1);
		b[i] = 0; sum -= k * i;
	}
	return r;
}
signed main() {
	while (cin >> n >> s) printf("%d\n", f(n));
}


Measured memory_bytes: 3212
L,R=tuple(map(int,input().split(' ')))

def gcd(m,n):
    temp=0
    while m%n!=0:
        temp=n
        n=m%n
        m=temp
    return n
def lcm(m,n):
    return m*n/gcd(m,n)


temp=[[(j*i)%2019 for i in range(j+1,min([j+2019+1,R+1]))] for j in range(L,min([L+2019+1,R]))]

#print(temp)
print(min([min(e) for e in temp]))


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

int main() {
    int a[3];

    for(int i=0;i<3;++i){
        cin>>a[i];
    }
    sort(a,a+3);
    if(a[0]==5 && a[1]==5 && a[2]==7)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct Node{
  struct Node *right;
  struct Node *left;
  struct Node *parent;
  int key;
};

struct Node *root,*NIL;

struct Node* find(struct Node *u,int k){
  while(u!=NIL && k!=u->key){
    if(k< u->key)u=u->left;
    else u=u->right;
  }
return u;
}

void insert(int k){
  struct Node *y = NIL;
  struct Node *x = root;
  struct Node *z;

  z = (struct Node *)malloc(sizeof(struct Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

while(x!=NIL){
y=x;
if(z->key < x->key){
  x=x->left;
}
else{
  x=x->right;
}
}
z->parent=y;
if(y==NIL){
  root=z;
}
else{
  if(z->key < y->key){
    y->left=z;
  }
  else{
    y->right=z;
  }
}
}

void inorder(struct Node *u){
if(u==NIL)return;
inorder(u->left);
printf(" %d",u->key);
inorder(u->right);
}
void preorder(struct Node *u){
if(u==NIL)return;
printf(" %d",u->key);
preorder(u->left);
preorder(u->right);
}

int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
if(com[0]=='f'){
  scanf("%d",&x);
  struct Node *t=find(root,x);
  if(t!=NIL)printf("yes\n");
  else printf("no\n");
}
  else if (strcmp(com,"insert")==0 ){
      scanf("%d", &x);
insert(x);
  }
  else if(strcmp(com,"print")==0){
    inorder(root);
    printf("\n");
    preorder(root);
    printf("\n");
  }
}
  return 0;
}



Measured memory_bytes: 20552
#include<stdio.h>
int main()
{
	int w,a,b;
	scanf("%d %d %d",&w,&a,&b);
	if(b >= a)
	{
		if(b <= a+w)
		{
			printf("0\n");
		}
		if(b > a+w)
		{
			printf("%d",b-(a+w));
		}
	}
	else if(b < a)
	{
		if(a <= b+w)
		{
			printf("0\n");
		}
		if(a>b+w)
		{
			printf("%d\n",a-(b+w));
		}
	}
	return 0;
}

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

typedef struct{int x,y;}zahyo;

char s[410][410];
int h,w;
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
bool gaisyutu[410][410];

bool hamideteru(zahyo c){
    return 0>c.x||c.x>=w||0>c.y||c.y>=h;
}

ll sum(zahyo c){
    ll siro=0,kuro=0;
    queue<zahyo>past;
    past.push(c);
    gaisyutu[c.y][c.x]=true;
    while(!past.empty()){
        zahyo a=past.front(); past.pop();
        if(s[a.y][a.x]=='#')kuro++;
        else siro++;
        for(int i=0;i<4;i++){
            zahyo n;
            n.x=a.x+dx[i]; n.y=a.y+dy[i];
            if(hamideteru(n)||gaisyutu[n.y][n.x])continue;
            if(s[a.y][a.x]!=s[n.y][n.x]){
                past.push(n);
                gaisyutu[n.y][n.x]=true;
            }
        }
    }
    return siro*kuro;
}

int main(){
    scanf("%d%d",&h,&w);
    for(int i=0;i<h;i++)scanf("%s",s[i]);

    int x,y;
    ll ans=0;
    for(x=0;x<w;x++)for(y=0;y<h;y++)gaisyutu[y][x]=false;

    for(x=0;x<w;x++)for(y=0;y<h;y++)if(!gaisyutu[y][x]){
        zahyo c;
        c.x=x;c.y=y;
        ans+=sum(c);
    
    }

    printf("%lld\n",ans);
}

Measured memory_bytes: 512
#define rep(i, n) for (int i=0; i<(int)(n); ++i)

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

int main(){
    int A,B,C;
    cin >> A >> B >> C;

    bool flg = true;

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

Measured memory_bytes: 256
coin500 = int(input())
coin100 = int(input())
coin50 = int(input())
X = int(input())

answer = 0

for i in range(coin500 + 1):
    for j in range(coin100 + 1):
        for k in range(coin50 + 1):
            if 500 * i + 100 * j + 50 * k == X:
                answer += 1

print(answer)


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

// Macros
#define F  first
#define S  second
#define PB push_back

// Rename Datatypes
using ll  = long long;
using ld  = long double;
using pii = pair<int,int>;

// Common Functions
ll fastpow(ll a, ll ex){ ll res = 1; while(ex){ if(ex & 1) res *= a; a *= a; ex >>= 1; } return res; }
ll fastpow(ll a, ll ex, ll m){ a %= m; ll res = 1; while(ex){ if(ex & 1) res = (a*res) % m; a = (a*a) % m; ex >>= 1; } return res; }
ll modinverse(ll a, ll m){ ll m0 = m, y = 0, x = 1; while (a > 1){ ll q = a / m; a %= m; swap(a,m); x -= q*y; swap(x,y); } if(x < 0) x += m0; return x; }

// HELPERS
//  Tedious Grid Movements
vector<pii> moves_grid = { {0,1} , {0,-1} , {1,0} , {-1,0} };
inline bool move_okay(int x, int y, int n, int m) { return 0 <= x and x < n and 0 <= y and y < m; }
//  Remember:
//   * vec.assign() GOOD; vec.resize() BAD
//   * comparator uses <

// Output, Common Containers
template <typename T> ostream& operator << (ostream& os, const vector<T>& v) { for (T i : v) os << i << ' '; return os; }
template <typename T> ostream& operator << (ostream& os, const set<T>& v)    { for (T i : v) os << i << ' '; return os; }
template <typename T, typename S> ostream& operator << (ostream& os, const pair<T,S>& v) { os << "(" << v.F << "=>" << v.S << ") "; return os; }
template <typename T, typename S> ostream& operator << (ostream& os, const map<T,S>& v)  { for (auto i : v) os << i << ' '; return os; }

// Debugging
#ifdef SANYAM1101
	#define trace(args...) do{ cerr << "Trace On! (Line: " << __LINE__ << ")\n"; d_f(string(#args), args); } while(0)
	void d_f(__attribute__((unused)) string str) {}
	template<typename Head, typename... Tails> void d_f(string str, Head H, Tails... T) { cerr << "\t" << str.substr(0, str.find(", ")) << " <=> [" << H << "]\n"; d_f(str.substr(str.find(", ") + 2), T...); }
#else
	#define trace(args...)
#endif


// CODE STARTS HERE

void solve(){
	int h, w, k;
	cin >> h >> w >> k;

	int grid[h][w];
	for(int i = 0; i < h; ++i){
		for(int j = 0; j < w; ++j){
			char ch; cin >> ch;
			grid[i][j] = ch == '#';
		}
	}

	int choices = 0;

	int copied[h][w];

	for(int m1 = 0; m1 < (1 << h); ++m1){
		for(int m2 = 0; m2 < (1 << w); ++m2){
			for(int i = 0; i < h; ++i){
				for(int j = 0; j < w; ++j){
					if(((m1 >> i) & 1) or ((m2 >> j) & 1))
						copied[i][j] = 0;
					else
						copied[i][j] = grid[i][j];
				}
			}

			int su = 0;
			for(int i = 0; i < h; ++i)
				su += accumulate(copied[i], copied[i] + w, 0);

			if(su == k) ++choices;
		}
	}

	cout << choices << "\n";
}

signed main (void){
	// Fast_IO
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	// Set Fixed Notation (default sucks), High Precision for Floating-Point Output
	cout << fixed << setprecision(20);

	// Multiple TCs
	int tt = 1;
	// cin >> tt;
	while(tt--) solve();
}


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

#define MAX (100000)
int A[MAX],n;

int partition(int p,int r){
    int x,i,j,t;
    x=A[r];
    i=p-1;
    for(j=p;j<r;j++){
        if(A[j]<=x){
            i++;
            t=A[i];A[i]=A[j];A[j]=t;
        }
    }
    t=A[i+1];A[i+1]=A[r];A[r]=t;
    return i+1;
}

int main(void){
    int i,q;
    scanf("%d",&n);
    for(i=0;i<n;i++)scanf("%d",&A[i]);
    q=partition(0,n-1);
    
    for(i=0;i<n;i++){
        if(i)printf(" ");
        if(i==q)printf("[");
        printf("%d",A[i]);
        if(i==q)printf("]");
    }
    printf("\n");
    return 0;
}



Measured memory_bytes: 3572
#include <iostream>

using namespace std;

int main() {
	int A,B;

	cin >> A >> B;

	for(int money = 1; money < 2000;money++){
		if((int)(money*0.08) == A && money/10 == B){
			cout << money << endl;
			return 0;
		}
	}

	cout << -1 << endl;
	return 0;
}

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

int isPrime(int x){
    if(x <= 1) return 0;
    else if(x == 2) return 1;
    else{
        if(x % 2 == 0) return 0;
        for(int i = 3; i * i <= x; i+=2){
            if(x % i == 0) return 0;
        }
        return 1;
    }
    

}

int main(void){
    int n;
    std::cin >> n;
    int x;
    int cnt = 0;
    for(int i = 0; i < n; i++){
        std::cin >> x;
        if(isPrime(x) == 1) cnt++;
    }
    std::cout << cnt << std::endl;

    return 0;
}


Measured memory_bytes: 3088
open Batteries
module EnumL = Enum.Labels
module ListL = List.Labels
module ArrayL = Array.Labels

let dbg0 x = Printf.eprintf "[debug]%s\n" @@ dump x
let dbg1 x = dbg0 x; x

let id = identity

let (++) n m = if n <= m then  List.range n `To m else []
let (++-) n m = if n >= m then List.range n `Downto m else []
let (++^) n m = if n < m then List.range n `To (pred m) else []

module ModOp = struct
  let prime = 1_000_000_007
  let (-) a b = (a + prime - b) mod prime
  let (+) a b = (a + b) mod prime
  let ( * ) a b = (a * b) mod prime

  let rec pow x n =
    if n = 0 then 1
    else if n mod 2 = 0 then pow (x*x) (n/2)
    else x * pow (x*x) (n/2)
end

let scan fmt = Scanf.sscanf (read_line ()) fmt

let scan_lines n fmt f =
  if n = 0 then []
  else List.map (fun _ -> scan fmt f) (1 ++ n)

let scan_list ?sep cnv =
  let line = read_line () in
  (match sep with
   | None -> List.map String.of_char @@ String.to_list line
   | Some sep -> String.split_on_char sep line)
  |> List.map cnv

let scan_array ?sep cnv = Array.of_list @@ scan_list ?sep cnv

let scan_matrix n m e ?sep conv =
  let arr = Array.make_matrix n m e in
  ListL.iter (0 ++^ n)
    ~f:(fun i -> arr.(i) <- Array.of_list @@ scan_list ?sep conv);
  arr

let atoi c = Char.code c - Char.code '0'
let itoa n = Char.chr (n + Char.code '0')

let rec powerset = function
  | [] -> [[]]
  | hd::tl ->
    let pws =  powerset tl in
    pws @ ListL.map pws ~f:(fun pw -> hd::pw)

let permutations l =
  let rec interleave x = function
    | [] -> [[x]]
    | (hd::tl) as l ->
      (x::l) :: (interleave x tl |> ListL.map ~f:(fun l -> hd::l)) in
  let rec aux = function
    | [] -> [[]]
    | a::rest ->
      aux rest |> ListL.map ~f:(interleave a) |> List.concat in
  aux l

let intersection l =
  EnumL.filter ~f:(fun x -> EnumL.exists ~f:((=) x) @@ Enum.clone l)

let zip l m =
  let n = min (List.length l) (List.length m) in
  List.combine (List.take n l) (List.take n m)

let lower_bound n f =
  let rec aux l u =
    if u - l > 1 then
      let m = (l + u) / 2 in
      if f m then aux l m
      else aux m u
    else u in aux (-1) n

let between n x m = n <= x && x < m

let n = scan "%d" id
let ls = scan_list ~sep:' ' Int.of_string

let () =
  let h = Hashtbl.create n in
  ListL.iter ls ~f:(fun v ->
      Hashtbl.modify_def 0 v succ h);
  let total = ListL.map (Hashtbl.to_list h) ~f:(fun (_,n) -> n * (pred n) /2) |> List.sum in
  ListL.iter ls ~f:(fun v ->
      let n = Hashtbl.find h v in
      Printf.printf "%d\n" @@ total - n*(pred n) /2 + (pred n) * (n-2)/2)


Measured memory_bytes: 30156
#include<bits/stdc++.h>
using namespace std;
const int md=1e9+7;
int dp[1000005];
int main()
{
	int n,sum;
	scanf("%d",&n);
	dp[0]=0;
	dp[1]=n;
	dp[2]=1ll*n*n%md;
	sum=(dp[1]+dp[2])%md;
	for(int i=3;i<=n;i++)
	{
		dp[i]=1ll*(n-1)*(n-1)%md;
		dp[i]=(dp[i]+sum)%md;
		dp[i]=(dp[i]-dp[i-2]+md)%md;
		dp[i]=(dp[i]+n-i+2)%md;
		sum=(sum+dp[i])%md;
	}
	printf("%d\n",dp[n]);
	return 0;
}

Measured memory_bytes: 4096
lst = input().split()

N = int(lst[0])
D = int(lst[1])

dot_list = []

for i in range(N):
   l = input().split()
   l[0] = int(l[0])
   l[1] = int(l[1])
   dot_list.append(l)

count = 0

for i in dot_list:
   x = i[0]
   y = i[1]
   if x**2 + y**2 <= D**2:
      count = count + 1

print(count)

Measured memory_bytes: 54928
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

const int MX = 200009;
vector<int> to[MX];
int t[MX];
int c[MX];
ll ans[MX];
ll f(ll n) { return n * (n + 1) / 2; }

int tfs(int v, int p=-1) {
  t[v] = 1;
  for (auto u : to[v]) {
    if (u == p) continue;
    t[v] += tfs(u, v);
  }
  return t[v];
}

stack<int> st[MX];
int d[MX], remsz[MX];
void dfs(int v, int p=-1) {
  st[c[v]].push(v);
  for (int u : to[v]) {
    if (u == p) continue;
    d[v] = t[u];
    dfs(u, v);
    ans[c[v]] -= f(d[v]);
  }
  st[c[v]].pop();
  if (st[c[v]].size()) {
    d[st[c[v]].top()] -= t[v];
  }
  else {
    remsz[c[v]] -= t[v];
  }
}

int main() {
  int n;
  cin >> n;
  rep(i,n) cin >> c[i], c[i]--;
  rep(i,n-1) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  tfs(0);
  rep(i,n) ans[i] = f(n);
  rep(i,n) remsz[i] = n;
  dfs(0);
  rep(i,n) ans[i] -= f(remsz[i]);
  rep(i,n) cout << ans[i] << endl;
  return(0);
}


Measured memory_bytes: 169872
n, m = map(int, input().split())
G = [[] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)
from collections import deque
que = deque()
col = [-1]*n
que.append(0)
col[0] = 0
g = [0]*2
g[0] = 1
yes = 1
while que:
    v = que.popleft()
    for t in G[v]:
        if col[t] == -1:
            col[t] = col[v]^1
            g[col[t]] += 1
            que.append(t)
        else:
            if col[t] == col[v]:
                yes = 0
if yes:
    ans = g[0]*g[1]
    for v in range(n):
        for t in G[v]:
            if v < t and col[v] != col[t]:
                ans -= 1
    print(ans)
else:
    print(n*(n-1)//2 - m)


Measured memory_bytes: 22448
#include<bits/stdc++.h>
#include<iomanip>
#include<numeric>

using namespace std;
using ll = long long;
constexpr int mo = 1e9+7;
constexpr int  mod = mo;
constexpr int inf = 1<<30;
constexpr int mo2 = 998244353;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n;
    cin>>n;
    vector<int> v(n);
    for(auto &a: v) cin>>a;
    int count = 1;
    for(int i=0;i<n;++i){
        if(v[i] == count)count++;
    }
    if(count-1 == 0)cout << -1 << endl;
    else cout << n-(count-1) << endl;
    return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for(ll i = 1; i < (ll)(n); i++)
const ll mo=1000000007;
ll ans=0;
ll dp[0][0];

int main()
{ 
ll n,a,b,t;
cin >> a>>b>>t;



cout << (t/a)*b << endl;
return 0;
} 

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

int main(){
	int a, b, c;
	cin >> a >> b >> c;
	vector<int> A(3);
	A = {a - b, b - c, c - a};
	for(int i = 0; i < 3; i++){
		if(A[i] < 0) A[i] *=(-1);
	}
	sort(A.begin(), A.end());
	int ans = A[0] + A[1];
	cout << ans << endl;
}

Measured memory_bytes: 256
// link:
// [prajwal1721]
// g++ -Wall -Wextra -Wshadow filename.cpp
// ./a.out >input <output
/*comments:
*/



#include<bits/stdc++.h>
using namespace std; 
#define mod 1000000007
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b))
#define bits(x) __builtin_popcountll(x)
#define vi              vector<int>
#define vl              vector<ll>
#define all(v)          v.begin(),v.end()
#define UNIQUE(X)       (X).erase(unique(all(X)),(X).end())



typedef long long int ll;
vector<ll> dp(1000004,INT32_MAX);
void solve()
{
    ll n,t,m;cin>>n>>m;t=0;
    ll w[n+1],val[n+1];
    dp[0]=0;
    for(int i=0;i<n;i++){cin>>w[i]>>val[i];t+=val[i];}
    // cout<<t<<"\n";
    for(int i=0;i<n;i++)
    {
        for(int j=t;j>=1;j--)
        {
            if((j-val[i]>0 && dp[j-val[i]]) || j==val[i])
                dp[j]=min(dp[j],dp[j-val[i]]+w[i]);
            // dp[j]=min()
        }
    }
    ll mx=0;
    for(ll i=1;i<=t;i++)if(dp[i]<=m)mx=max(mx,i);
    cout<<mx<<"\n";


}


int main()
{ 
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // ll t;cin>>t;
    // cout<<t<<"Hi test complete\n";
    // while(t--)
        {
            solve();
        }


    return 0;
}

Measured memory_bytes: 10964
#include <bits/stdc++.h>
typedef long long int ll;
#define pb push_back
#define cases long long int t;cin>>t;while(t--)
#define fio ios::sync_with_stdio(false); cin.tie(0)
#define ALL(v) (v).begin(), (v).end() 
#define twod(n,m) vector<vector<int> > arr( n , vector<int> (m, 0))
#define prs(s,n) for(ll i=0;i<n;i++)cout<<s[i];
#define pra(arr,n) for(ll i=0;i<n;i++)cout<<arr[i]<<" ";
#define err1(a) cout<<#a<<" "<<a<<endl;
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl;
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl;
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl;
using namespace std;
int main() 
{
	fio;
	char ch;
    cin>>ch;
    if(isupper(ch))
        cout<<'A';
    else
        cout<<'a';
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
int main() {
    int i,j,k,ans;
    int p,q,r;
    cin>>p>>q>>r;
    ans=min(p+q,p+r);
    ans=min(ans,q+r);

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

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

for cx in range(101):
    for cy in range(101):
        height = set(hi + abs(xi-cx) + abs(yi-cy) for xi, yi, hi in xyh if hi > 0)
        if len(height) == 1:
            H = max(height)
            if all(set(hi==max(H - abs(xi-cx) - abs(yi-cy), 0) for xi, yi, hi in xyh if hi == 0)):
                print(cx, cy, H)
                exit()

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

#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
#define PI 3.14159265358979
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}

vector<pair<int,ll>> vec[100000];
ll cost[100000];
void dfs(int now,ll COST){
    cost[now]=COST;
    int next;
    REP(i,vec[now].size()){
        next=vec[now][i].first;
        if(cost[next]<0){
            dfs(next,COST+vec[now][i].second);
        }
    }
}
int counter(int x){
    if(!x)return 0;
    return counter(x>>1)+(x&1);
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N=in();
    int M=in();
    int C=in();
    int B[M];
    REP(i,M){
        cin>>B[i];
    }
    int ans;ans=0;
    REP(i,N){
        int A;
        int s;s=0;
        REP(j,M){
            cin>>A;
            s+=A*B[j];
        }
        if(s+C>0)ans++;
    }
    print(ans);
    return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define fol(i,n) for(int i=0;i<n;i++)
#define pb push_back
typedef long long ll;
typedef pair<int,int> P;
typedef vector<P> vip;

int main(){
    bool flag=true;
    int n;cin>>n;
    int x1,x2,y1,y2,t1,t2;
    x1 = 0,y1=0,t1=0;
    fol(i,n){
        cin >> t2 >> x2 >> y2;
        if ((t2-t1)%2!=abs(x1-x2+y1-y2)%2){flag=false;break;}
        if (t2-t1<abs(x1-x2)+abs(y1-y2)){flag=false;break;}
        x1 = x2,y1=y2,t1=t2;
    }
    if(flag){
        cout << "Yes"<<endl;
    }else{
        cout <<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
string S;
int main() {
  cin >> S;
  bool hasC = false;
  if (S[0] != 'A') {
    cout << "WA" << endl;
    return 0;
  }
  if (S[1] < 'a' || 'z' < S[1]) {
    cout << "WA" << endl;
    return 0;
  }
  for (int i = 2; i < (S.size() - 1); i++) {
    if (hasC && (S[i] == 'C')) {
      cout << "WA" << endl;
      return 0;
    }
    if (S[i] == 'C') {
      hasC = true;
    } else if (S[i] < 'a' || 'z' < S[i]) {
      cout << "WA" << endl;
      return 0;
    }
  }
  if (!hasC) {
    cout << "WA" << endl;
    return 0;
  }
  if (S[S.size() - 1] < 'a' || 'z' < S[S.size() - 1]) {
    cout << "WA" << endl;
    return 0;
  }
  cout << "AC" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>

int n, a[200];

int main(){
    scanf("%d", &n);

    int tmp, min = 1145141919;
    for(int i = 0; i < n; i++){
        scanf("%d", &tmp);

        a[i] = tmp;
    }

    for(int i = 0; i < n; i++){
        int cnt = 0;

        while(a[i] % 2 == 0){
            a[i] /= 2;
            cnt++;
        }

        if(cnt < min) min = cnt;
    }

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

    return 0;
}


Measured memory_bytes: 128
def main():
    s = int(input())
    mod = 10**9+7
    dp = [0] * (s+1)
    dp[0] = 1
    for i in range(1, s+1):
        for j in range(0, (i-3)+1):
            dp[i] += dp[j]
            dp[i] %= mod
    print(dp[s])

if __name__ == "__main__":
    main()


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

int main() {
  long n,ans=0;
  cin >> n;
  vector<long> a(n);
  for(long i=0;i<n;i++) cin >> a[i];
  sort(a.begin(),a.end());
  for(long i=0;i<n;i++) {
    for(long j=i+1;j<n;j++) {
      for(long k=j+1;k<n;k++) {
        if(a[i]+a[j]>a[k]) {
          ans++;
          if(a[i]==a[j]||a[j]==a[k]) ans--;
        }
      }
    }
  }
  cout << ans << endl;
}

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


int main() {
	int L,R,d;
	cin >> L >> R >> d;
	int ans = 0;
	for (int i = L; i <= R; i++) {
		if (i % d == 0) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <cstdio>

using namespace std;


int main() {
	string S;
	cin >> S;
	if(S == "ABC") {
		cout << "Yes" << endl;
		return 0;
	}

	char c;
	while(1) {
		int cou = 0;
		string tmp = "";
		int alf[3] = {};
		for(int i = 0; i < S.size(); i++) {
			alf[S[i] - 'A']++;
		}
		
		if(alf[0] <= alf[1] && alf[0] <= alf[2]){ c = 'A';cou++;}
		if(alf[1] <= alf[0] && alf[1] <= alf[2]){ c = 'B';cou++;}
		if(alf[2] <= alf[0] && alf[2] <= alf[1]){ c = 'C';cou++;}
		if(cou > 1){
			cout << "No" << endl;
			return 0;
		}

		for(int i = 0; i < S.size(); i++) {
			if(i < S.size() - 2 && S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C') {
				tmp += c;
				i += 2;
				cou++;
			} else {
				tmp += S[i];
			}
		}

		if(tmp == "ABC") {
			cout << "Yes" << endl;
			return 0;
		}
		if(S == tmp) {
			cout << "No" << endl;
			return 0;
		}

		S = tmp;
	}

	return 0;
}


Measured memory_bytes: 3236
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <math.h>

#define mp                  make_pair
#define F                   first
#define S                   second
#define pb                  push_back
#define FOR(i,j,n)          for(int i=j;i<n;i++)
#define F0R(i,j,n)          for(int i=j;i<=n;i++)
#define RFOR(i,j,n)         for(int i=n-1;i>=j;i--)
#define RF0R(i,j,n)         for(int i=n;i>=j;i--)
#define FOREACH(x,v)        for(auto x:v)
#define ITFOR(it,v)         for(v::iterator it =v.begin();it!=v.end();++it)
#define __in_arr__(a,j,n)   FOR(i,j,n)cin >> a[i];
#define __out_arr__(a,j,n)  FOR(i,j,n)cout << a[i];
#define LOG                 cout << "[ !" << __LINE__ << "L ] " << endl;
#define PLOG(x)             cout << "[ !" << __LINE__ << "L ] " \<<x<<endl;

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int n;cin >>n;
    int ans = 0;
    FOR(i,0,n){
        int x,y;
        cin >> x >> y;
        ans += y-x + 1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
      	String a = sc.next();
      	char[] S = new char[a.length()];
      	for (int i=0; i<a.length(); i++){
          S[i] = a.charAt(i);
        }
		int counter = 0;
      	char key = S[0];
      	for (int i=0; i<a.length(); i++){
          if (key != S[i]){
            counter++;
          }
          if(key == '0'){
            key = '1';
          }else{
            key = '0';
          }
        }
      	System.out.println(counter);
    }
}

Measured memory_bytes: 25556
import java.io.PrintWriter;
import java.util.Scanner;

class D {
    public static void main(String... args) {
        final Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        final int k = (int) Math.round(.5 + .5 * Math.sqrt(1 + 8 * N));
        if (k * (k - 1) / 2 == N) {
            final PrintWriter pw = new PrintWriter(System.out, false);
            pw.println("Yes");
            pw.println(k);
            final int[][] map = new int[k][k];
            for (int i = 0, c = 1; i < k; i++)
                for (int j = 0; j < i; j++)
                    map[i][j] = map[j][i] = c++;
            for (int i = 0; i < k; i++) {
                pw.print(k - 1);
                for (int j = 0; j < k; j++)
                    if (i != j) {
                        pw.print(' ');
                        pw.print(map[i][j]);
                    }
                pw.println();
            }
            pw.flush();
        } else {
            System.out.println("No");
        }
    }
}
public class Main {
    public static void main(String...args) {
		D.main();
    }
}


Measured memory_bytes: 36852
#include <stdio.h>

#define MAX_N 1000

int main(void){
  int i, j, k;

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

  int player_opponent[MAX_N+1][MAX_N-1]={};
  for(i=1; i<=n; i++){
    for(j=0; j<n-1; j++){
      scanf("%d", &player_opponent[i][j]);
    }
  }

  int game_num[MAX_N+1]={};
  int game_finish[MAX_N+1]={};
  int next_player[MAX_N+1]={};
  for(i=1; i<=n; i++){
    next_player[i]=player_opponent[i][0];
  }

  int flag=0, finish_player=0;
  for(i=1;;i++){
    flag=0;
    for(j=1; j<=n; j++) game_finish[j]=0;
    for(j=1; j<=n; j++){
      k=next_player[j];
      if(k==0) continue;
      if(game_finish[j] == 0 && game_finish[k] == 0 && next_player[k] == j){
        //printf("%d %dvs%d\n", i, j, k);
        game_num[j]++; game_num[k]++;
        next_player[j]=player_opponent[j][game_num[j]];
        next_player[k]=player_opponent[k][game_num[k]];
        game_finish[j]=1; game_finish[k]=1;
        if(game_num[j] == n-1) finish_player++;
        if(game_num[k] == n-1) finish_player++;
        flag=1;
      }
    }

    if(flag==0){
      printf("-1\n");
      return 0;
    }else if(finish_player == n){
      break;
    }
  }

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

  return 0;
}


Measured memory_bytes: 4096
import numpy as np
n, d = map(int, input().split())
x = []
for i in range(n):
    x.append(list(map(int, input().split())))

# print(x)

xn = np.array(x)

# print(xn[0, 0])

cnt = 0
for i in range(n - 1):
    tmp1 = xn[i, :]
    for j in range(i + 1, n):
        tmp2 = xn[j, :]
        tmp = 0
        for k in range(d):
            tmp += (tmp1[k] - tmp2[k]) * (tmp1[k] - tmp2[k])
        ans = np.sqrt(tmp)
        if ans % 1 == 0:
            cnt += 1

print(cnt)

Measured memory_bytes: 12468
#include "bits/stdc++.h"

#define REP(i,num) for(ll i=0;i<(num);++i)
#define FOR(i,c,num) for(ll (i)=(c);(i)<(num);++(i))
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=ll>
T in(){T x; cin >> x; return (x);}
template<typename T=ll,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return x;}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

template<typename T>
bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>
bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	auto H=in(),W=in();
	ll minS = 1ll<<60;
	REP(i,H-1){
		ll S1 = W*(i+1);
		ll RH = H-(i+1);

		ll S2a=(W/2)*RH,S3a=(W-W/2)*RH;
		ll S2b=W*(RH/2),S3b=W*(RH-RH/2);
		minS = min({minS,max({S1,S2a,S3a})-min({S1,S2a,S3a}),max({S1,S2b,S3b})-min({S1,S2b,S3b})});
	}
	REP(i,W-1){
		ll S1 = H*(i+1);
		ll RH = W-(i+1);

		ll S2a=(H/2)*RH,S3a=(H-H/2)*RH;
		ll S2b=H*(RH/2),S3b=H*(RH-RH/2);
		minS = min({minS,max({S1,S2a,S3a})-min({S1,S2a,S3a}),max({S1,S2b,S3b})-min({S1,S2b,S3b})});
	}
	out(minS);
	return 0;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> h(N);
  for (int i = 0; i < N; i++) cin >> h[i];
  const int INF = (2 << 30) - 1;
  vector<int> dp(N, INF);
  dp[0] = 0;
  for (int i = 1; i < N; i++) {
    int k = min(i, K);
    for (int j = 1; j <= k; j++) dp[i] = min(dp[i - j] + abs(h[i] - h[i - j]), dp[i]);
  }
  cout << dp[N - 1] << endl;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(){
    int m,f,r;
    while(cin>>m>>f>>r){
        if(m==-1 && f==-1 && r==-1)break;
        if(m==-1||f==-1)
            cout<<"F"<<endl;
          
      else   if(m==-1)m=0;
      else  if(f==-1)f=0;
   else if(m+f>=80)cout<<"A"<<endl;
    else if(m+f>=65)cout<<"B"<<endl;
    else if(m+f>=50)cout<<"C"<<endl;
    else if(m+f>=30&&r>=50)cout<<"C"<<endl;
    else if(m+f>=30)cout<<"D"<<endl;
    else cout<<"F"<<endl;
}
}

Measured memory_bytes: 3088
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <queue>

#include <iomanip>

using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define FIND(x, target) find(x.begin(),x.end(),target)
#define pb(x) push_back(x)
#define pob(x) pop_back(x)
#define output(x) cout<<x<<endl
#define ERASE(x, n) x.erase(x.begin()+n)
// #define int long long
// #define P pair<int, int>
typedef long long ll;

const long long int MOD = 1e9+7;
const ll INF = 1e17;
// ll dp[100005][13];
ll dp[10005];

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

signed main(void) {
  ll N;
  cin >> N;

  cout << (N+1)/2 << endl;
}


Measured memory_bytes: 256
using namespace std;
#include<iostream>
 
int main()
{
    int N;
    cin>>N;
    char S[N];
    int x=0,max=0;
    for(int j=0;j<N;j++)
    cin>>S[j];
    for(int i=0;i<N;i++)
    {
        if(S[i]=='I')
        x++;
        else
        x--;
 
        if(x>=max)
        max=x;
 
    }
    cout<<max;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n-1); i >= 0; i--)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin>>n;
  vector<ll>a(n);
  rep(i,n)cin>>a[i];
  vector<ll>sa(n);
  vector<vector<ll>>kouho(n+1,vector<ll>(3,-1));
  rep(i,n){
    sa[a[i]]++;

  }
  ll f=1;
  rep(i,n){
    if(sa[i]>3)f=0;
  }
  kouho[0]={-1,-1,-1};
  repi(i,1,n+1){
    kouho[i]=kouho[i-1];
    ll fl=0;
    rep(j,3){
      if(kouho[i-1][j]==a[i-1]-1){
        kouho[i][j]++;
        fl=1;
        break;
      }
    }
    if(fl==0)f=0;
    sort(all(kouho[i]));
  }
  ll res=1;
  ll mod=1e9+7;
  vector<ll>dp(6);
  rep(i,n){
    ll cnt=0;
    rep(j,3){
      if(kouho[i][j]==a[i]-1)cnt++;
    }
    res*=cnt;
    res%=mod;
  }
  cout<<res<<endl;



  return 0;

}


Measured memory_bytes: 7296
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <vector>
using namespace std;
int n,x,total=0,c=0;
vector<int> m;
int main(void)
{
    int tmp;
    cin >> n >> x;
    for(int i=1;i<=n;i++){
        cin >> tmp;
        total += tmp;
        m.push_back(tmp);
    }
    sort(m.begin(),m.end());
    c = n;
    x -= total;
    cout << c + x / m[0];
    return 0;
}

Measured memory_bytes: 256