akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define elif else if
#define ffast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define filoop(n) for(ll i=0;i<(n);i++)
#define fjloop(n) for(ll j=0;j<(n);j++)

int main()
{
    ffast;
    //freopen("0in.txt","r",stdin);
    //freopen("0out.txt","w",stdout);



        int n,r;
        cin>>n>>r;
        if(n>=10) printf("%d\n",r);
        else printf("%d\n",(100*(10-n)+r));


    return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mem(ar,num) memset(ar,num,sizeof(ar))
#define me(ar) memset(ar,0,sizeof(ar))
#define lowbit(x) (x&(-x))
#define Pb push_back
#define  FI first
#define  SE second
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define IOS ios::sync_with_stdio(false)
#define DEBUG cout<<endl<<"DEBUG"<<endl; 
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int    prime = 999983;
const int    INF = 0x7FFFFFFF;
const LL     INFF =0x7FFFFFFFFFFFFFFF;
const double pi = acos(-1.0);
const double inf = 1e18;
const double eps = 1e-6;
const LL     mod = 1e9 + 7;
LL qpow(LL a,LL b){LL s=1;while(b>0){if(b&1)s=s*a%mod;a=a*a%mod;b>>=1;}return s;}
LL gcd(LL a,LL b) {return b?gcd(b,a%b):a;}
int dr[2][4] = {1,-1,0,0,0,0,-1,1};
typedef pair<int,int> P;
const int maxn = 500+10;
LL a[maxn];
LL b[maxn];
LL ans = 1;
int n,k;

void update(LL x){
	LL t = 0;
	for(int j = 1;j <= n; ++j)
		b[j] = a[j]%x, t += b[j];
	sort(b+1,b+n+1,greater<LL>());
	LL tt = t;
	for(int j = 1;j <= tt/x; ++j)
		t -= b[j];
	if(t <= k)
		ans = max(ans,x);
}
int main(void)
{
	cin>>n>>k;
    LL sum = 0;
	for(int i = 1;i <= n; ++i)
		cin>>a[i],sum += a[i];
	// cout<<sum<<endl;
	for(LL i = 2;i*i <= sum; ++i){
		if(sum % i == 0){
			update(i);
			update(sum/i);
		}
	}
	update(sum);

	cout<<ans<<endl;

   	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

vector<int> graph[100005]; // 1-indexed
int N;

vector<int> dist;
void dfs(int cur, int d=0, int p=-1) {
  dist[cur] = d;
  for (auto next : graph[cur]) {
    if (next == p) continue;
    dfs(next, d+1, cur);
  }
}

vector<int> calcDist(int start) {
  dist = vector<int>(N+1); // 初期化
  dfs(start);
  return dist;
}

int main() {
  // UからのdistとVからのdistを比較、Vからの距離の方が大きい頂点で最大のもの−1
  int U, V;
  cin >> N >> U >> V;
  rep(i, N-1) {
    int a, b;
    cin >> a >> b;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  vector<int> dist_U = calcDist(U);
  vector<int> dist_V = calcDist(V);
  int ans = 0;
  for (int i = 1; i < N+1; i++) {
    if (dist_U[i] < dist_V[i]) {
      ans = max(ans, dist_V[i] - 1);
    }
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 13712
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#define EPS 1e-8
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;

class Point
{
  public:
  double x,y;
  Point(double x = -1,double y = -1): x(x),y(y){}

  Point operator + (Point p ){return Point(x+p.x,y+p.y);}
  Point operator - (Point p){return Point(x-p.x,y-p.y);}
  Point operator * (double a){return Point(a*x,a*y);}
  Point operator / (double a){return Point(x/a,y/a);}//※イケメンに限る

  bool operator < (const Point& p) const
  {
    return x != p.x?x<p.x:y<p.y;
  }

  bool operator == (const Point& p)const
  {
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
  }
};

struct Segment
{
  Point p1,p2;
  Segment(Point p1 = Point(-1,-1),Point p2 = Point(-1,-1)):p1(p1),p2(p2){}
};
typedef Segment Line;
typedef vector<Point> Polygon;

double dot(Point a,Point b)
{
  return a.x*b.x + a.y*b.y;
}
double cross(Point a,Point b)
{
  return a.x*b.y - a.y*b.x;
}

double norm(Point a)
{
  return a.x*a.x+a.y*a.y;
}


Point getCrossPointLines( Line s1, Line s2){
    Point a = s1.p2 - s1.p1;
    Point base = Point(s2.p2.x - s2.p1.x,s2.p2.y - s2.p1.y);
    return s1.p1 + a * (cross(base, s2.p1 - s1.p1)/cross(base, a));
}


int ccw(Point p0,Point p1,Point p2)
{
  Point a = p1-p0;
  Point b = p2-p0;
  if(cross(a,b) > 0)return COUNTER_CLOCKWISE;
  if(cross(a,b) < 0)return CLOCKWISE;
  if(dot(a,b) < 0)return ONLINE_BACK;
  if(norm(a) < norm(b))return ONLINE_FRONT;
  return ON_SEGMENT;
}

Polygon cutPolygon( Polygon P, Line l ){
    Polygon u;
    for ( int i = 0; i < P.size(); i++ ){
        Point a = P[i], b = P[(i+1)%P.size()];
        if ( ccw(l.p1, l.p2, a) != CLOCKWISE ) u.push_back(a);
        if ( ccw(l.p1, l.p2, a) * ccw(l.p1, l.p2, b) == -1 ){
	  u.push_back(getCrossPointLines(Segment(a, b), l));
        }
    }
    return u;
}


void printPolygon(Polygon p)
{
  cout << "printPolygon --------------- "<< endl;
  rep(i,p.size())
    cout << "(" << p[i].x << "," << p[i].y << ")" << " ";
  cout << endl;
}


int main()
{ 
  int n;
  while(cin >> n,n)
    {
      Point p[n];
      rep(i,n)
	cin >> p[i].x >> p[i].y;
      Polygon poly(n);
      rep(i,n)
	poly[i] = p[i];
      rep(i,n)
	poly = cutPolygon(poly,Line(p[i],p[(i+1)%n]));
      
      poly.empty()?cout << 0 << endl:cout << 1 << endl;
      
    }
  return 0;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
using namespace std;
#define FASTIO  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define vi vector<ll>
#define all(a) (a).begin(), (a).end()
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define tr(it, a)   for(auto it=a.begin();it!=a.end();it++)
#define pb push_back
#define endl  "\n"
#define mem(a,b)  memset(a,b,sizeof(a))
const ll MAX=1e5+3;
const ll mod=1e9+7;
int main()
{
   FASTIO
   int t=1;
   //cin>>t;
   while(t--)
  {
        ll a,b;cin>>a>>b;
        if((a==1 && b==2) || (b==1 && a==2))
            cout<<"3";
        if((a==1 && b==3) || (a==3 && b==1))
            cout<<"2";
            if((a==3 && b==2) ||(a==2 && b==3))
            cout<<"1";
   }
 return 0;
}



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

int main()
{

	string text;

	getline(cin,text);
	while(text[0] != '.'){
		int ans=1 ,brac[100]={0} ,n=0;
		for(int i=0 ; text[i]!='.'; i++){
			//test	cout<<(int)text[i]<<" ";
			if(text[i]=='('){
				brac[n]=1;
				n++;
			}
			if(text[i]==')'){
				if(n==0) ans=0;
				else if(brac[n-1]!=1) ans=0;
				else{
					n--;
					brac[n]=0;
				}
			}
			if(text[i]=='['){
				brac[n]=2;
				n++;
			}
			if(text[i]==']'){
				if(n==0) ans=0;
				else if(brac[n-1]!=2) ans=0;
				else{
					n--;
					brac[n]=0;
				}
			}
			if(ans==0) break;
		}
		if(ans==0 ||  n!=0) cout<<"no"<<endl;
		else cout<<"yes"<<endl;
		getline(cin,text);
	}
}

Measured memory_bytes: 1172
def is_same(str):
  assert len(str) == 6
  if str[2] != str[3]:
    return False
  if str[4] != str[5]:
    return False
  return True

if __name__ == "__main__":
  s = list(input())

  if is_same(s):
    print('Yes')
  else:
    print('No')


Measured memory_bytes: 2940
#include<bits/stdc++.h>
 
using namespace std;
#define pb push_back
#define REP(ii,aa,nn) for(long long int ii=(aa);(ii)<=(nn);(ii)++)
 
typedef vector<int> vi;
typedef long long int ll;


int main(){
ll r,d,x;cin>>r>>d>>x;

		REP(i,0,9){
			
			x=r*x-d;
			
			if(x<0)
			cout<<0<<endl;
			else
			cout<<x<<endl;
			
		}
	return 0;
}


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

#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 EPS (1e-7)
#define MAX_N 100
#define INF 1e9

typedef long long ll;

typedef pair<int,int>P;

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

const int MAX_V=100000;
vector<int> G[MAX_V];
ll V;

int color[MAX_V];

//頂点を-1と1で塗っていく
bool dfs(int v, int c){
	color[v]=c;
	for(int i=0;i<G[v].size();i++){
		//隣接している頂点が同じ色ならfalse
		if(color[G[v][i]]==c)return false;
		//隣接している頂点がまだ塗られていないなら-cで塗る
		if(color[G[v][i]]==0 && !dfs(G[v][i],-c))return false;
	}
	return true;
}
//グラフが連結の時は1回のdfsで大丈夫
void solve(){
	for(int i=0;i<V;i++){
		if(color[i]==0){
			if(!dfs(i,1)){
				printf("NO\n");
				return;
			}
		}
	}
}

int main(){	
	cin>>V;
	ll m;
	cin>>m;
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}

	bool judge=dfs(0,1);

	if(!judge){
		cout<<V*(V-1)/2-m<<endl;
	}else{
		ll b=0;
		ll w=0;
		for(int i=0;i<V;i++){
			if(color[i]==1)b++;
			else if(color[i]==-1)w++;
		}
		cout<<b*w-m<<endl;
	}
	return 0;
}

Measured memory_bytes: 6528
#include<stdio.h>
int main()
{
    int i,x=0;
    char s[150];
    scanf("%s",s);
    for(i=0; i<strlen(s); i++)
    {
        if(i%2==0 && s[i]=='L')
        {
           x=1;
           break;
        }
        else if(i%2==1 && s[i]=='R')
        {
            x=1;
            break;
        }

    }
    if(x==1)
    {
         printf("No");
    }
    else
    {
         printf("Yes");
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include<iomanip>
#include<algorithm>
using namespace std;

int x[101], y[101];
int n;

double mink(int p){
	if (p == 0){
		double Max = 0;
		for (int i = 0; i < n; i++){
			Max = max(Max, double(abs(x[i] - y[i])));
		}
		return Max;
	}
	else{
		double sum = 0;
		for (int i = 0; i < n; i++){
			sum += pow((abs(x[i] - y[i])), p);
		}
		return pow(sum, 1.0 / (double)p);
	}
}


int main()
{
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> x[i];
	}
	for (int i = 0; i < n; i++){
		cin >> y[i];
	}
	cout << fixed << setprecision(8);
	cout << mink(1) << endl;
	cout << mink(2) << endl;
	cout << mink(3) << endl;
	cout << mink(0) << endl;

	return 0;
}

Measured memory_bytes: 1300
#__author__ = "tatuo"
#__date__ = "$Mar 3, 2018 12:34:20 PM$"

import math
import re
import sys


def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result




arr_data = getinputdata()

s1 = arr_data[0][0][0]
s2 = arr_data[1][0][1]
s3 = arr_data[2][0][2]

print(s1+s2+s3)



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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    string s;
    cin >> s;
    int32 ans = 0;
    REP(i,n-2){
        if(s.substr(i,3) == "ABC")ans++;
    }
    ANS(ans);
    return 0;
}

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

int main(){
    vector<int> menu(5);
    vector<int> ceiled(5);
    for(int i=0; i<5; i++){
        cin >> menu[i];
        if(menu[i] % 10 == 0) ceiled[i] = 0;
        if(menu[i] % 10 != 0) ceiled[i] = 10 - menu[i] % 10;
    }
    sort(ceiled.begin(),ceiled.end());

    int time = 0;
    for(int i=0; i<5; i++){
        time += menu[i] + ceiled[i];
    }
    cout << time - ceiled[4] << endl;
    return 0;
}

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

using namespace std;

#define F first
#define S second

const int MAXN = 2e5 + 10;
const int LOG = 21;
const int MOD = 1e9 + 7;

int n, x, y, seg[LOG][MAXN], pt[MAXN*4];
int ss[MAXN], tt[MAXN];
bool vis[MAXN];
pair<int, int> a[MAXN];

int pw(int a, int b){
	int ret = 1;
	while (b){
		if (b & 1)
			ret = 1ll*ret*a%MOD;
		b >>= 1;
		a = 1ll*a*a%MOD;
	}
	return ret;
}

bool cmp(int u, int v){return a[u].S < a[v].S;}

void plant(int v, int b, int e, int de = 0){
	pt[v] = b;
	if (e - b == 1){
		seg[de][b] = b;
		return;
	}

	int mid = b + e >> 1;
	plant(v<<1, b, mid, de+1);
	plant(v<<1^1, mid, e, de+1);
	merge(seg[de + 1] + b, seg[de + 1] + mid, seg[de + 1] + mid, seg[de + 1] + e, seg[de] + b, cmp);
}

int q[MAXN], h, t, cnt[MAXN];

void go(int v, int b, int e, int l, int r, int rem, int de=0){
	if (l <= b && e <= r){
		while (pt[v] < e && a[seg[de][pt[v]]].S <= rem){
			if (!vis[seg[de][pt[v]]]){
				vis[seg[de][pt[v]]] = 1;
				q[t++] = seg[de][pt[v]];
			}
			pt[v]++;
		}
		return;
	}
	if (r <= b || e <= l) return;

	int mid = b + e >> 1;
	go(v<<1, b, mid, l, r, rem, de+1);
	go(v<<1^1, mid, e, l, r, rem, de+1);
}

int main(){
	ss[0] = 1;
	for (int i = 1; i < MAXN; i++)
		ss[i] = 1ll*ss[i-1]*i%MOD;
	tt[0] = 1;
	for (int i = 1; i < MAXN; i++)
		tt[i] = pw(ss[i], MOD - 2);

	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> x >> y;
	for (int i = 0; i < n; i++)
		cin >> a[i].F >> a[i].S;
	sort(a, a + n);
	plant(1, 0, n);

	int ans = 1;
	for (int v = 0; v < n; v++)
		if (!vis[v]){
			h = t = 0;
			q[t++] = v;
			vis[v] = 1;
			while (t - h){
				int v = q[h++];
				{
					int r = lower_bound(a, a + n, make_pair(a[v].F, -1)) - a;
					go(1, 0, n, 0, r, y-a[v].S);
					int l = lower_bound(a, a + n, make_pair(a[v].F+1, -1)) - a;
					go(1, 0, n, l, n, y-a[v].S);
				}
				{
					int l = lower_bound(a, a + n, make_pair(a[v].F, -1)) - a;
					int r = lower_bound(a, a + n, make_pair(a[v].F+1, -1)) - a;
					go(1, 0, n, l, r, x-a[v].S);
				}
			}

			int ret = ss[t];
			for (int i = 0; i < t; i++)
				cnt[a[q[i]].F]++;

			for (int i = 0; i < t; i++)
				if (cnt[a[q[i]].F]){
					ret = 1ll*ret*tt[cnt[a[q[i]].F]]%MOD;
					cnt[a[q[i]].F] = 0;
				}

			ans = 1ll*ans*ret%MOD;
		}
	
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 23168
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int bit = 0;
		for(int i=0; i<N; i++){
			bit |= sc.nextInt();
		}
		System.out.println(Integer.numberOfTrailingZeros(bit));
		}
	}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, double> pid;
typedef pair<double, int> pdi;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int A, B;
	cin >> A >> B;
	cout << (B - A)*(B - A + 1) / 2 - B << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define watch(x) cout<<"->"<<#x<<" : "<<x<<endl;
signed main()
{
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n;
	cin>>n;
	int b[n-1];
	for(int i=0;i<n-1;i++)cin>>b[i];
	int a[n];
	for(int i=0;i<n-1;i+=1)a[i]=b[i],a[i+1]=b[i];
	for(int i=0;i<n-1;i++)
	{
		if(max(a[i],a[i+1])>b[i])
		{
			if(a[i+1]==max(a[i],a[i+1]))
				a[i+1]=b[i];
			else
				a[i]=b[i];
		}
	}
	int res = 0;
	for(int val : a)res+=val;
	cout<<res<<endl;
	return 0;	
}

Measured memory_bytes: 256
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int now = n;
    int ans = 0;
    rep(i,n){
        int m;
        cin >> m;
        if(now>=m){
            ans++;
            // cout << i+1 <<endl;
        }
        now = min(now,m);
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 3640
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <ios> 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	string s;
	cin>>s;
	ll now=0,ans=0;
	for (int i=0;i<s.size();i++){
		if (s[i]=='A'){now++;continue;}
		if (now>0 && s[i]=='B' && i<s.size()-1 && s[i+1]=='C'){ans+=now,i++;continue;}
		now=0;continue;
	}
	cout<<ans;
}

Measured memory_bytes: 640
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main()
{
    let s: String = read();
    let mut before = s.chars().next().unwrap();
    
    for ch in s.chars().skip(1) {
        if before == ch {
            println!("Bad");
            return;
        }
        before = ch;
    }
    println!("Good");
    return;
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M; cin >> N >> M;
  cout << ((M*1900) + (N-M)*100) * pow(2, M) << endl;

}


Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		final Scanner sc = new Scanner(System.in);
		
		System.out.println(sc.next().replace(",", " "));
		
	}
	
	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;
 
		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}
 
		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}
 
		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}
 
		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		
		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}
 
		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 8404
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(int argc, char const *argv[]) {
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;

  //先に計算したほうがいいけど無視
  // tがsの第一象限側にあるとき、[U,R,D,L]。これを基準にして、あとからひっくり返す。
  vector<int> path(0);
  for (int i = 1; i <= abs(ty - sy); i++) {
    path.push_back(0);
  }
  for (int i = 1; i <= abs(tx - sx) + 1; i++) {
    path.push_back(1);
  }
  for (int i = 1; i <= abs(ty - sy) + 1; i++) {
    path.push_back(2);
  }
  for (int i = 1; i <= abs(tx - sx) + 1; i++) {
    path.push_back(3);
  }
  path.push_back(0);
  //二周目
  path.push_back(3);

  for (int i = 1; i <= abs(ty - sy) + 1; i++) {
    path.push_back(0);
  }
  for (int i = 1; i <= abs(tx - sx) + 1; i++) {
    path.push_back(1);
  }
  for (int i = 1; i <= abs(ty - sy) + 1; i++) {
    path.push_back(2);
  }
  for (int i = 1; i <= abs(tx - sx); i++) {
    path.push_back(3);
  }

  string dir[4];
  if (tx - sx >= 0 && ty - sy >= 0) {
    dir[0] = "U";
    dir[1] = "R";
    dir[2] = "D";
    dir[3] = "L";
  } else if (tx - sx >= 0 && ty - sy < 0) {
    dir[0] = "D";
    dir[1] = "R";
    dir[2] = "U";
    dir[3] = "L";
  } else if (tx - sx < 0 && ty - sy >= 0) {
    dir[0] = "U";
    dir[1] = "L";
    dir[2] = "D";
    dir[3] = "R";
  } else {
    dir[0] = "D";
    dir[1] = "L";
    dir[2] = "U";
    dir[3] = "R";
  }

  for (int i = 0; i < path.size(); i++) {
    cout << dir[path[i]];
  }
  cout << "\n";
  return 0;
}


Measured memory_bytes: 384
#define _CRT_SECURE_NO_WARNINGS
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <array>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <bitset>
#include <utility>
#include <assert.h>
#include <regex>
#include <numeric>
using namespace std;

typedef unsigned long long ull;
typedef signed long long ll;
#define INF (1LL << 48)

struct PT { ll x; ll y; };
string to_s(ull x) { return to_string(x); }
string to_s(ll x) { return to_string(x); }
ll to_ll(const string& x) { return stoll(x); }
ull to_ull(const string& x) { return stoull(x); }




int main(int argc, char* argv[])
{
	for (;;) {
		int N, a, b;
		cin >> N;
		if (cin.fail()) break;

		ll res = 0;
		a = 0;
		for (int i = 0; i < N; i++) {
			cin >> b;
			res += (a + b) / 2;
			a = b > 0 ? ((a + b) & 1) : 0;
		}
		cout << res << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define INF 1007654321
#define PI 3.14159265358979
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repp(i, s, e) for(int i = (s); i <= (e); ++i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0)
template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v) { for (auto x : v) os << x << " "; return os << "\n"; }

int cnt[2][2000][2000];
int pcnt[2][2001][2001];

int range(int t, int x1, int y1, int x2, int y2) {
    return pcnt[t][x2][y2] - pcnt[t][x1][y2] - pcnt[t][x2][y1] + pcnt[t][x1][y1];
}

int main() {
    FAST_IO();
    string S; cin >> S;
    int N = sz(S);
    int i = (N - 1) / 2, j = N / 2;
    char center = S[i];
    while(i >= 0 && j < N && S[i] == center && S[j] == center) {
        --i;
        ++j;
    }
    cout << N - i - 1 << endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#define N 10001
using namespace std;

int main(){
  int n;
  int p[N], pn=0;
  bool isPrime[N];

  for( int i=0;i<N;i++ ) isPrime[i]=true;

  for( int i=2;i<N;i++ ){
    if( !isPrime[i] ) continue;
    p[pn++] = i;
    for( int j=2*i;j<N;j+=i ) isPrime[j]=false;
  }

  while( cin>>n && n ){
    // nより大きい要素を指す最小のポインタ
    int *q=upper_bound( p,p+pn,n );
    q--;
    while( *q - *(q-1) != 2 ) q--;

    cout << *(q-1) << " " << *q << endl;
  }

  return 0;
}

Measured memory_bytes: 888
object Main extends App{
  val input = io.StdIn.readLine.split(' ').map(_.toDouble)
  val A = input(0)
  val B = input(1)
  val H = input(2)
  val M = input(3)

  val radH = (H + M / 60d)  / 6.0d
  val radM = M / 30.0d

  val radD = radH - radM

  val posH = (0d, A)
  val posM = (- B*Math.sin(radD * Math.PI), B*Math.cos(radD * Math.PI))

  val distance = Math.sqrt( Math.pow(posH._1 - posM._1 , 2) + Math.pow(posH._2 - posM._2, 2) )

  printf("%.10f",distance)
}

Measured memory_bytes: 54832
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>   
using namespace std;
using namespace __gnu_pbds;
typedef long long ll; 
#define int long long
typedef unsigned long long lu;
typedef vector<ll> v;
typedef vector<vector<ll> > vv;
typedef vector<string>  vs;
typedef vector<pair<ll,ll>> vpr;
typedef long double ld;
#define f(i,n) for(ll i = 0; i < n; i++)
#define ff(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define amax(x,y) if(y>x) x=y;
#define amin(x,y) if(y<x)x=y;
#define bg(x) x.begin()
#define sz(x) (ll)x.size()
#define in(x,n) for(ll i=0;i<n;i++)cin>>x[i]
#define out(x,n) for(ll i=0;i<n;i++)cout<<x[i]<<" " 
#define mxt(a) *(max_element(a.begin(),a.end()))
#define mnt(a) *(min_element(a.begin(),a.end())
#define tc ll t;cin>>t;while(t--)
typedef pair<ll,ll> pi;
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
#define yesno(f) if(f) yes else no
const v dx = {1, -1, 0, 0};
const v dy = {0, 0, 1, -1};
const ll mod=1e9+7;
const ld PI = 2 * acos(0.0);
ll m(ll a){ return (a+mod)%mod;}
ll cel(ll x1,ll y1){if((x1%y1)==0)return x1/y1;else return x1/y1+1;}
ll power(ll a,ll b,ll m)
{
    if(b==0)
        return 1;
    ll d=power(a,b/2,m);
    d=(d*d)%m;
    if(b&1)
        d=(d*a)%m;
    return d;
}
// set_name.find_by_order(k) It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time
// set_name.order_of_key(k) It returns to the number of items that are strictly smaller than our item k in O(logn) time.
/*string operations :
str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
str.substr (x) : returns a substring str[x],... end of string
str.find(qtr) : returns the first occurenece of qtr in str */
int32_t main()
{
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int n,m,x;cin>>n>>m>>x;
    vv a(n,v(m));
    v cost(n,0);
    for(int i=0;i<n;i++)   
    {
        cin>>cost[i];
        for(int j=0;j<m;j++)
            cin>>a[i][j];
    }
    int N=(1ll<<n);
    vv arr(N,v(m,0));
    int inf=1e17;
    int mn=inf;
    for(int i=1;i<N;i++)
    {
        int bit=0;
        int cost1=0;
        for(int j=0;j<n;j++)
        {
            if((i&(1ll<<j))>0)
            {
                cost1+=cost[j];
                bit=j;
            }
        }
        arr[i]=arr[i-(1ll<<bit)];
        bool flg=true;
        for(int j=0;j<m;j++)
        {
            arr[i][j]+=a[bit][j];
            if(arr[i][j] < x)
                flg=false;
        }
        if(flg)
            mn=min(mn,cost1);
    }
    if(mn==inf)
        cout<<-1<<endl;
    else
        cout<<mn<<endl;
    return 0;
}

Measured memory_bytes: 3936
# このファイルは，UTF-8 で書かれている．
use strict;
use warnings;
use utf8;
use open IO => ":encoding(UTF-8)";
use open ":std";
# 以上はテンプレートである．編集しないこと．

my $N = <STDIN>;
chomp($N);
my $A = <STDIN>;
chomp($A);

print $N*$N - $A, "\n"



Measured memory_bytes: 1792
H, W = map(int, input().split())

a = [list(input()) for i in range(H)]

WHITE = '.'
BLACK = '#'

new_a = []

for i in range(H):
    if BLACK in a[i]:
        new_a.append(a[i])

new_H = len(new_a)
new_W = len(new_a[0])
new_a2 = [[] for i in range(new_H)]

for j in range(new_W):

    has_black = False

    for i in range(new_H):
        if new_a[i][j] == BLACK:
            has_black = True

    if has_black:
        for i in range(new_H):
            new_a2[i].append(new_a[i][j])

for row in new_a2:
    for data in row:
        print(data, end='')
    print('')



Measured memory_bytes: 43352
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
#define V vector<int>
#define S set<int>
#define itn int
bool dbg = false;
itn N;
void solve() {
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N;
    if (N % 2 == 0) {
        std::cout << std::fixed << std::setprecision(10) << 0.5 << endl;
    } else {
        double n;
        n = N;
        std::cout << std::fixed << std::setprecision(10) << ((N / 2) + 1.0) / n << endl;
    }
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    ll a;
    cin >> a;
    cout << a + (a * a) + (a * a * a) << endl;
}


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

int main()
{
  int n;
  std::cin >> n;
  std::cin.ignore();
  
  for (int i = 0; i < n; ++i) {
    std::string str;
    std::getline(std::cin, str);
    
    auto pos = str.find("Hoshino", 0, 7);
    while (pos != std::string::npos) {
      str.replace(pos, 7, "Hoshina", 7);
      pos = str.find("Hoshino", pos, 7);
    }

    std::cout << str.c_str() << std::endl;
  }

  return 0;
}

Measured memory_bytes: 1220
/*
 * @Author: Luisvacson
 * @LastEditors: Luisvacson
 * @Descriptions: None
 * @Date: 2020-03-22 20:18:23
 * @LastEditTime: 2020-03-22 20:19:33
 * @FilePath: \VSCode\C++\Practice\AC abc159 C.cpp
 */
#include<bits/stdc++.h>
using namespace std;

int L;
signed main(){
    scanf("%d",&L);
    double a=(double)(L*1.0/3);
    printf("%.12lf\n",pow(a,3));
    return 0;
}

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

typedef pair<int,int> pi;
typedef pair<pi,int> p;

int dp[400][400];

int main()
{
    int n;
    while(scanf(" %d", &n),n)
    {
        vector<p> a(n);
        rep(i,n)
        {
            int x,y,w;
            scanf(" %d %d %d", &x, &y, &w);
            a[i] = p(pi(x,y),w);
        }
        sort(all(a));

        memset(dp,0,sizeof(dp));
        rep(i,n)
        {
            int start = a[i].fi.fi;
            int end = a[i].fi.se;
            int w = a[i].se;

            for(int x=366; x>0; --x)for(int y=x; y>0; --y)
            {
                if(start<y) continue;

                int min_v = min(end+1,x), max_v = max(end+1,x);
                dp[min_v][max_v] = max(dp[min_v][max_v], dp[y][x]+w);
            }
        }

        int ans=0;
        rep(i,400)rep(j,400) ans=max(ans,dp[i][j]);
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 3704
from array import array

M, N = map(int, raw_input().split())
K = input()

D0 = [array('l', [0]) * (N+1) for _ in xrange(M+1)]
D1 = [array('l', [0]) * (N+1) for _ in xrange(M+1)]

for i in xrange(1, M+1):
    a = raw_input()
    for j in xrange(1, N+1):
        D0[i][j] = D0[i-1][j] + D0[i][j-1] - D0[i-1][j-1] + (a[j-1] == 'J')
        D1[i][j] = D1[i-1][j] + D1[i][j-1] - D1[i-1][j-1] + (a[j-1] == 'O')

for _ in xrange(K):
    b0, b1, b2, b3 = map(int, raw_input().split())
    nJ = D0[b2][b3]-D0[b0-1][b3]-D0[b2][b1-1]+D0[b0-1][b1-1]
    nO = D1[b2][b3]-D1[b0-1][b3]-D1[b2][b1-1]+D1[b0-1][b1-1]
    nI = (b2-b0+1)*(b3-b1+1)-nJ-nO
    print nJ, nO, nI

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

#define ll long long int

static const auto _____ = []() {
    // fast IO code : this I understand
    ios::sync_with_stdio(false);
    cout.tie(NULL);
    cin.tie(0);
    return 0;
}();

int main(){
	int n;
	cin>>n;
  	ll sum = 0;
  	for(int i=1;i<n;i++){
		sum += (n-1)/i;
	}
  	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

#define MAX_V 1000000

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, K;
	cin >> N >> K;

	ll x[N], y[N];
	vector<ll> vx, vy;
	rep(i, 0, N) {
		cin >> x[i] >> y[i];
		vx.push_back(x[i]);
		vy.push_back(y[i]);
	}

	vsort(vx);
	vsort(vy);
	ll res = (vx[N - 1] - vx[0]) * (vy[N - 1] - vy[0]);

	rep(xi, 0, N) {
		rep(xj, xi + 1, N) {
			rep(yi, 0, N) {
				rep(yj, yi + 1, N) {
					int count = 0;
					ll lx = vx[xi], rx = vx[xj];
					ll by = vy[yi], uy = vy[yj];

					rep(i, 0, N) {
						if(lx <= x[i] and x[i] <= rx and by <= y[i] and y[i] <= uy) count++;
					}
					if(count >= K) res = min(res, (rx - lx) * (uy - by));
				}
			}
		}
	}
	cout << res << endl;

		

}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200000


int main() {
	char a[N + 1];
	f(i, N + 1)a[i] = 0;
	int n, k;
	int x, y, z;
	long long s, ans;
	bool v = true;
	ans = 0;
	scanf("%s", a);
	n = strlen(a);
	f(i, n) {
		if (a[i] == 'x')ans++;
	}

	if(ans<8)printf("YES\n");
	else printf("NO\n");


	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;
#define all(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0; i<(n);++i)
#define FOR(i,k,n) for(int i=(k);i<(n);++i)

const ll MOD = 1000000007;

int main(){
    int n,m;cin>>n>>m;
    vector<ll> x(n),y(m);
    REP(i,n)cin>>x[i];
    REP(i,m)cin>>y[i];
    ll w=0,h=0;
    for(int i=n-1;i>=0;i--){w+=(x[i]+MOD)*(MOD+2*i-n+1);w%=MOD;}
    for(int i=m-1;i>=0;i--){h+=(y[i]+MOD)*(MOD+2*i-m+1);h%=MOD;}
    cout<<(h*w)%MOD<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h> 
#define FOR(i,a,b) for(int i=(a);i<=(b);++i) 
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i) 
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>0;--i)
#define CI cin>> 
#define CO cout<<
#define EN <<endl 
#define all(x) (x).begin(),(x).end()
using namespace std;
template <typename T> istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; 	return is; }
using ll = long long;
using VI = vector<int>;

int main() {
	int n; CI n;
	VI v(n); CI v;
	VI c(n); CI c;

	int ans = 0;

	REP(i, n) {
		if (v[i] > c[i])ans += v[i] - c[i];
	}
	CO ans EN;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<time.h>
#include<cstdlib>
typedef long long ll;
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#define mm(a) memset(a,0,sizeof(a))
#define lr rt<<1
#define rr rt<<1|1
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0);
#define inf 0x3f3f3f3f
#define eqs 1e-8
#define lb(x) (x&(-x))
#define ch(a) (int(a-'a')+1)
#define rep(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
typedef pair<int,int> pii;
const double pi=acos(-1);
const int maxn=3005;;
//const ll Mod=1000000007;
const ll Mod=998244353;
using namespace std;

ll ans=0;
ll dp[maxn];
ll a[maxn];
int main()
{
    sync;
    int n,k;
    cin>>n>>k;
    rep(i,1,n)
    cin>>a[i];
    ll ans=0;
    dp[0]=1;
    rep(i,1,n)
    {
        for(int j=k;j-a[i]>=0;j--)
        {
            dp[j]+=dp[j-a[i]];
            dp[j]%=Mod;
        }
        ans+=dp[k];
        ans%=Mod;
        dp[0]++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#Union Find
#xの根を求める
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
#xとyの属する集合の併合
def unite(x,y):
    x = find(x)
    y = find(y)
    
    if x == y:
        return False
    else:
        #sizeの大きいほうがx
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True

#xとyが同じ集合に属するかの判定
def same(x,y):
    return find(x) == find(y)

#xが属する集合の個数
def size(x):
    return -par[find(x)]


N,M = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(M)]

ans = 0
for i in range(M):
    #初期化
    #根なら-size,子なら親の頂点
    par = [-1]*N
    for j in range(M):
        if i==j:
            continue
        else:
            unite(ab[j][0]-1,ab[j][1]-1)
    
    if size(1)!=N:
        ans+=1

print(ans)

Measured memory_bytes: 68380
def main():
    n = int(input())
    array_s = []
    array = []
    for i in range(n):
        array_s.append(input())

    for s in array_s:
        array.append(''.join(sorted(s)))
    array = sorted(array)
    ans = 0
    count = 1
    for i in range(n-1):
        if array[i] == array[i+1]:
            count += 1
            if i != n-2:
                continue
        ans += int(count*(count-1)/2)
        count = 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 18520
n = int(input())
a = list(map(int,input().split()))

b = [0]

for i in a:
    b.append(b[-1] + i)

d = {}
ans = 0

for i in b:
    if i in d:
        d[i] += 1
    else:
        d[i] = 1

for k,v in d.items():
    ans += v * (v-1) // 2

print(ans)


Measured memory_bytes: 130884
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<ll(b);i++)
#define repr(i,a,b) for(ll i=a;i>=ll(b);i--)
#define endl "\n"
#define ALL(x) x.begin(),x.end()
#define ALLR(x) x.rbegin(),x.rend()
#define INF 1e9
#define DEBUG(x) cout<<"debug: "<<x<<endl
using namespace std;

string n;
int main() {
	cin  >> n;
	for(auto x : n){
		if(x == '7'){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t, f=0,s=0,middle1,middle2;
  double middle = 0;
  vector<int> a;
  cin >> n;
  for (int i = 0; i < n; ++i)
  {
    cin >> t;
    middle += t;
    a.push_back(t);
  }
  middle1 = ceil(middle / n);
  middle2 = floor(middle / n);
  for (int i = 0; i < n; ++i)
  {
    f += (a[i] - middle1) * (a[i] - middle1);
    s += (a[i] - middle2) * (a[i] - middle2);
  }
  cout << min(f,s);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define ARRAY_LEN(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
typedef long long ll;
 
int main() {
  int H, W; cin >> H >> W;
  vector<vector<string>> S(H, vector<string>(W));
  for (int i=0; i<H; i++) {
    string S_tmp; cin >> S_tmp;
    for (int j=0; j<W; j++) S[i][j] = S_tmp[j];

  }
  for (int i=0; i<H; i++) { for (int j=0; j<W; j++) cin >> S[i][j]; }

  vector<vector<int>> result(H, vector<int>(W, 0));
  for (int i=0; i<H; i++) { 
    for (int j=0; j<W; j++) {
      if (S[i][j] == "#") { cout << "#"; continue; }
      if ( i!=0 && j!=0 ) { if ( S[i-1][j-1]=="#" ) result[i][j] ++; }
      if ( i!=0 ) { if ( S[i-1][j]=="#" ) result[i][j] ++; }
      if ( i!=0 && j!=W-1 ) { if ( S[i-1][j+1]=="#" ) result[i][j] ++; }
      if ( j!=0 ) { if ( S[i][j-1]=="#" ) result[i][j] ++; }
      if ( j!=W-1 ) { if ( S[i][j+1]=="#" ) result[i][j] ++; }
      if ( i!=H-1 && j!=0 ) { if ( S[i+1][j-1]=="#" ) result[i][j] ++; }
      if ( i!=H-1 ) { if ( S[i+1][j]=="#" ) result[i][j] ++; }
      if ( i!=H-1 && j!=W-1 ) { if ( S[i+1][j+1]=="#" ) result[i][j] ++; }
      cout << result[i][j];
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 384
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    a,b=MI()
    ans=-1
    for i in range(10000):
        aa=int(i*0.08)
        bb=i//10
        if a==aa and b==bb:
            ans=i
            break
    print(ans)

main()


Measured memory_bytes: 39536
/**
 *  winners never quit
**/

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
typedef long long Long;
void FastIO(){
  ios::sync_with_stdio(0);
  cin.tie(0);cout.tie(0);
}

const int N = 1e5;

int main()
{
  FastIO();
  int tc, ca = 0;
  Long a, b, c, k;
  cin >> a >> b >> c >> k;
  Long sum = 0;
  Long cut = min(a, k);
  k -= cut;
  sum += cut;
  cut = min(b, k);
  k -= cut;
  cut = min(c, k);
  k -= cut;
  sum -= cut;
  cout << sum << '\n';
  return 0;
}


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

int main(){
    int H, W, K;
    cin >> H >> W >> K;
    vector<vector<char> > c(H, vector<char>(W));
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++) cin >> c.at(i).at(j);
    }
    vector<set<int> > gyou(H), retu(W);
    int sharp_count = 0;
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            if(c.at(i).at(j) == '#'){
                gyou.at(i).insert(j);
                retu.at(j).insert(i);
                sharp_count++;
            }
        }
    }
    int glo_count = 0;
    for (int tmp1 = 0; tmp1 < (1 << H); tmp1++) {
        bitset<6> s1(tmp1);
        for(int tmp2 = 0; tmp2 < (1 << W); tmp2++){
            bitset<6> s2(tmp2);
            int loc_count = 0;
            for(int k=0; k<H; k++){
                if(s1.test(k)) loc_count += gyou.at(k).size();
            }
            for(int k=0; k<W; k++){
                if(s2.test(k)){
                    loc_count += retu.at(k).size();
                    for(auto itr=retu.at(k).begin();itr!=retu.at(k).end();itr++){
                        if(s1.test(*itr)) loc_count--; 
                    }
                }
            }
            if((sharp_count - loc_count) == K) glo_count++;
        }
    }
    cout << glo_count << endl;
}

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

int main() {
    int a,b;
    cin >> a >> b;
    int A = a/100;
    int B = b/ 100;
    int ans = B-A+1;

    int a1 = a/10000, a2= (a%10000)/1000;
    int c = a/100 * 100 + a2 * 10 + a1;
    int b1 = b/10000, b2= (b%10000)/1000;
    int d = b/100 * 100 + b2 * 10 + b1;

    if(a > c){
        ans--;
    }

    if(b < d){
        ans--;
    }

    cout << ans << endl;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e18;
//const int INF=(1<<30);


int main(){
  int a,b,c;
  cin >> a >> b >>c;
  cout << (a<=c && c<=b ? "Yes" : "No") << endl; 

}



Measured memory_bytes: 256
def main():
  decks = {
      "a": raw_input(),
      "b": raw_input(),
      "c": raw_input(),
  }
  turn = "a"
  
  while True:
      if len(decks[turn]) == 0:
        break
      new_turn = decks[turn][0]
      decks[turn] = decks[turn][1:]
      turn = new_turn
  print(turn.upper())

main()

Measured memory_bytes: 2568
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] numbers = new int[n];
		for (int i = 0; i < n; i++) {
			numbers[i] = sc.nextInt();
		}
		System.out.println(count(numbers, n));
		sc.close();
	}

	public static int count(int[] numbers, int n) {
		int count = 0;
		for (int i = 0; i < n; i++) {
			if (primeNumbers(numbers[i])) {
				count++;
			}
		}
		return count;

	}

	public static boolean primeNumbers(int num) {
		boolean flag = true;
		if (num == 2) {
			return flag;
		} else if (num % 2 == 0) {
			flag = false;
			return flag;
		} else {
			for (int i = 3; i <= Math.sqrt(num); i += 2) {
				if (num % i == 0) {
					flag = false;
					break;
				}
			}
			return flag;
		}

	}
}



Measured memory_bytes: 41292
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const ll INF = 1001001001;
const ll LINF = 1001001001001001001;

void prvec(vector<ll> vec){
    ll n = vec.size();
    rep(i,n) cout << i << " " << vec.at(i) << "\n";
}

void pr2d(vector<vector<ll>> vvec){
    ll h = vvec.size();
    ll w = vvec.at(0).size();
    rep(i,h){
        rep(j,w){
            cout << vvec.at(i).at(j) << " ";
        }
        cout << "\n";
    }
}

int main(){
    ll a,b,c,d; cin >> a >> b >> c >> d;
    cout << max(max(a*c,a*d),max(b*c,b*d)) << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int a;
  cin>>a;
  a=a%10;
  if(a==2||a==4||a==5||a==7||a==9){cout<<"hon"<<endl;}
  else if(a==3){cout<<"bon"<<endl;}
  else{cout<<"pon"<<endl;}
}

Measured memory_bytes: 3636