akhauriyash/Code-Regression huggingface dataset:
# include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
template<typename T>vector<T> make_v(size_t a){ return vector<T>(a); }
template<typename T,typename... Ts>auto make_v(size_t a, Ts... ts){ return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template<typename T,typename V>typename enable_if<is_class<T>::value==0>::type fill_v(T &t, const V &v){ t = v; }
template<typename T,typename V>typename enable_if<is_class<T>::value!=0>::type fill_v(T &t, const V &v){ for(auto &e : t) fill_v(e, v); }
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int n;
double t, a;
double h[1010];

int ans = -1;
double minl = HINF<double>();

int main(){
    INIT;
    cin >> n >> t >> a;
    REP(i, n){
        cin >> h[i];
        double te = t - h[i]*0.006;
        if(abs(te - a) < minl){
            ans = i;
            minl = abs(te - a);
        }
    }
    cout << ans + 1 << endl;
}

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

int main()
{
	int N;;
	cin >> N;
	vector< long long> A( N );
	for( int i = 0; i < N; i++ ) {
		string S;
		cin >> S;
		int idx = S.find( '.' );
		int pr = 1;
		if( idx == string::npos ) {
			idx = S.size();
			pr = 0;
		}
		long long d = 0;
		for( int j = 0; j < idx + 9 + pr; j++ ) {
			if( j < S.size() ) {
				if( S[j] == '.' ) continue;
				d = d * 10 + S[j] - '0';
			}
			else d *= 10;
		}
		A[i] = d;
	}

	typedef pair<int, int> P;
	map<P, int> mp;
	for( int i = 0; i < N; i++ ) {
		long long a = A[i];
		int n2 = 0;
		while( a % 2 == 0 ) {
			n2++;
			a /= 2;
		}
		int n5 = 0;
		while( a % 5 == 0 ) {
			n5++;
			a /= 5;
		}
		mp[P( n5, n2 )]++;
	}
	long long ans = 0;
	for( auto it = mp.begin(); it != mp.end(); it++ ) {
		int i5 = it->first.first;
		int i2 = it->first.second;
		long long cnt = it->second;
		if( i5 >= 9 && i2 >= 9 ) {
			ans += cnt * (cnt - 1) / 2;
		}
		for( auto it1 = next( it ); it1 != mp.end(); it1++ ) {
			int j5 = it1->first.first;
			int j2 = it1->first.second;
			long long cnt1 = it1->second;
			if( i5 + j5 >= 9 * 2 && i2 + j2 >= 9 * 2 ) {
				ans += cnt * cnt1;
			}
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 4668
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		long h = sc.nextLong();

		int n = 0;
		double hp = 1;
		for(int i=0;i<100;i++) {
			if(i!=0) {
				hp *= 2;
			}
			if(h<hp) {
				n=i;
				break;
			}
		}

		long ans = 0;
		for(int i=0;i<n;i++) {
			double add = Math.pow(2, i);
			ans += (long)add;
		}

		System.out.println(ans);

	}
}


Measured memory_bytes: 22992
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
typedef complex<double> Point;
const double EPS = 1.0e-9;
const double PI = acos(-1);
namespace std {
    bool operator < (const Point& a, const Point& b){
        return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
    }
}
struct Line : public vector<Point> {
    Line(const Point& a, const Point& b){
        push_back(a);
        push_back(b);
    }
};
double cross(const Point& a, const Point& b){
    return imag(conj(a) * b);
}
Point cross_point(const Line& l, const Line& m){
    double A = cross(l[1] - l[0], m[1] - m[0]);
    double B = cross(l[1] - l[0], l[1] - m[0]);
    if (abs(A) < EPS && abs(B) < EPS) return m[0]; // same line
    if (abs(A) < EPS) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
    return m[0] + B / A * (m[1] - m[0]);
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int test; cin >> test;
    rep(casenum, test){
        Point a, b, c, m1, m2, d1, d2;
        cin >> a.real() >> a.imag() >> b.real() >> b.imag() >> c.real() >> c.imag();
        m1 = (a + b) / 2.0, m2 = (b + c) / 2.0;
        d1 = polar(1.0, arg(b - a) + PI / 2.0), d2 = polar(1.0, arg(c - b) + PI / 2.0);
        Line l1(m1, m1 + d1), l2(m2, m2 + d2);
        Point ans = cross_point(l1, l2);
        double r = abs(ans - a);
        printf("%.3lf %.3lf %.3lf\n", ans.real(), ans.imag(), r);
    }
    return 0;
}

Measured memory_bytes: 1344
#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() {
	int k;
	int a[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	scanf("%d", &k);
	printf("%d\n", a[k - 1]);
	return 0;
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> PP;

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

int n;
vector<int> ans;

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

	cin>>n;
	int sum=0,i=1;
	while(sum<n) {
		sum+=i;i++;
	}
	if(sum==n) {
		FOR(j,1,i) cout<<j<<endl;
	}
	else {
		int tmp=sum-n;
		FOR(j,1,i) if(j!=tmp) cout<<j<<endl;
	}

	return 0;
}


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

dp = [0]*(w+1)
for i in range(n):
    for j in range(w,wv[i][0]-1,-1):
        dp[j] = max(dp[j],dp[j-wv[i][0]]+wv[i][1])

print(max(dp))

Measured memory_bytes: 41964
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        string[] cin = Console.ReadLine().Split();
        int a = int.Parse(cin[0]);
        int b = int.Parse(cin[1]);
        int c = int.Parse(cin[2]);
        int d = int.Parse(cin[3]);
        if (a + b < c + d) Console.WriteLine("Right");
        else if (a + b > c + d) Console.WriteLine("Left");
        else Console.WriteLine("Balanced");
    }
}

Measured memory_bytes: 13140
/*#include<iostream>
using namespace std;

int main(){
    string str;
    int count = 0;
    int i = 0;
    int flag = 0;
    int m_flag = 0;

    cin >> str;
    
    while(str[i] != '\0'){
        if(str[i] != str[i + 1]){
            flag = 1;
            i = 0;
            break;
        }
        i++;
    }

    //cout << flag << '\n';

    if(flag == 1){
        while(1){
            i = 0;
            while(str[i] != '\0'){
                if(str[i] != str[i + 1]){
                    if(str[i + 1] != '\0'){
                        m_flag = 1;
                        break;
                    }
                }
                i++;
            }
            if(m_flag == 0){
                break;
            }
            i = 0;
            m_flag = 0;

            if(str[0] == 'W'){
                str.insert(0,"B");
            }
            else{
                str.insert(0,"W");
            }

            if(str[0] == 'B'){
                while(1){
                    str[i + 1] = 'B';
                    if(str[i + 2] == 'B' || str[i + 2] == '\0'){
                        break;
                    }
                    i++;
                }
            }
            else{
                while(1){
                    str[i + 1] = 'W';
                    //cout << str << '\n';
                    if(str[i + 2] == 'W' || str[i + 2] == '\0'){
                        break;
                    }
                    i++;
                }
            }
            count++;
        }
    }

    if(flag == 0){
        cout << "0\n";
    }
    else{
        cout << count << '\n';
    }

    return 0;
}*/

#include<iostream>
using namespace std;

int main(){
    string str;
    int i = 0;
    int cnt = 0;
    cin >> str;

    while(str[i] != '\0'){
        if(str[i] != str[i + 1]){
            if(str[i + 1] != '\0'){
                cnt++;
            }
        }
        i++;
    }

    cout << cnt << '\n';

    return 0;
}

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

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

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

	int A = 0, B = 0;
	for(int i = 0; i < s.size(); i++) A += ((i % 2 and s[i] == '0') or ((i % 2 == 0) and s[i] == '1'));
	for(int i = 0; i < s.size(); i++) B += ((i % 2 and s[i] == '1') or ((i % 2 == 0) and s[i] == '0'));
	printf("%d\n", std::min(A, B));
	return 0;
}


Measured memory_bytes: 512
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 掲示板のサイズ
		int N = sc.nextInt();
      	// 張り紙の高さ
      	int H = sc.nextInt();
      	// 張り紙の横幅
      	int W = sc.nextInt();
      	
      	int count=0;
      
      	for(int i=0;i<N;i++){
        	for(int t=0;t<N;t++){
				if((i+W<=N)&&(t+H<=N)){
      				count++;          	
                }
            }
        }
      	System.out.println(count);
    }
}

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

using namespace std;

int main(){
	int tt, d1, d2, cs = 0;
	cin >> tt;
	while(tt--){
		cin >> d1 >> d2;
		if (d1 == d2)
			cs ++;
		else if (cs < 3)
			cs = 0;
	}
	if (cs >= 3){
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
	return 0;
}
		


Measured memory_bytes: 3604
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7

n,t = MAP()
dp = [0] * 6005
ab = []
for i in range(n):
    ab.append(MAP())

ab.sort(key=lambda x: x[0])
for u in ab:
    for i in range(6004-u[0], -1, -1):
        if i < t:
            dp[i+u[0]] = max(dp[i+u[0]], dp[i] + u[1])
print(max(dp))

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)

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

typedef long long ll;

void solve(long long X) {
    ll A = -1000;
    ll B = -1000;
    while (A * A * A * A * A - B * B * B * B * B != X) {
        if (A * A * A * A * A - B * B * B * B * B < X) {
            A++;
        } else {
            B++;
        }
    }
    cout << A << " " << B << endl;
}

int main() {
    long long X;
    scanf("%lld", &X);
    solve(X);
    return 0;
}

Measured memory_bytes: 3752
#include<bits/stdc++.h>
    using namespace std;
    #define rep(i, n) for (int i = 0; i < (int)(n); i++)
     
    int main(){
      int k;
      cin >> k;
      int a, b;
      cin >> a >>b;
      for(int i = a; i<=b;i++){
        if(i%k==0) {
          cout << "OK" << endl;
          return 0;
        }
      }
      cout << "NG" << endl;
    }

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>
#include <iterator>


typedef long long ll;
typedef unsigned long long ull;
constexpr ll mop = 1000000007;
constexpr ll mop2 = 998244353;

using namespace std;

int main() {
	ll n;
	cin >> n;
	for (ll i = 0; i < n; i++) {
		vector<ll> v(3);
		for (ll j = 0; j < 3; j++) {
			cin >> v[j];
		}
		sort(v.begin(), v.end(), greater<ll>());
		if (v[0] * v[0] == v[1] * v[1] + v[2] * v[2]) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}



Measured memory_bytes: 3164
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#include<bitset>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main(void){
    int n;
    long long ans = 0;
    cin >> n;
    vector<int> buf(n);

    //配列bufをfalseで初期化
    rep(i,n){
        buf.at(i) = false;
        if((i+1)%3!=0 && (i+1)%5!=0){
            buf.at(i) = true;
        }
    }

    rep(i,n){
        if(buf.at(i)){
            ans += i+1;
        }
    }

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

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

int main(void){
  int a,b,k,count = 0;
  cin >> a >> b >> k;
  for(int i = 100; i > 0; i--){
    if(a % i == 0 && b % i == 0){
      count++;
    }
    if(count == k){
      cout << i << endl;
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
template<typename T> auto compare = [](T x, T y) -> bool{return (x < y);};
const int MOD = 1000000007;

ll N, K;
ll A[200010];

signed main(){
    cin >> N >> K;
    REP(i, N) cin >> A[i];
    sort(A, A + N);
    ll ans = 1;
    if(A[N - 1] <= 0 && K % 2 == 1){
        for(int i = N - 1; i >= N - K; i--) ans = (ans * A[i]) % MOD;
        PRINT((ans + MOD) % MOD);
        return 0;
    }
    int l = 0, r = N - 1;
    if(K % 2 == 1){
        ans = (ans * A[r]) % MOD;
        r--; K--;
    }
    for(int i = 0; 2 * i < K; i++){
        if(A[l] * A[l + 1] >= A[r - 1] * A[r]){
            ans = (ans * ((A[l] * A[l + 1]) % MOD)) % MOD;
            l += 2;
        }else{
            ans = (ans * ((A[r - 1] * A[r]) % MOD)) % MOD;
            r -= 2;
        }
    }
    PRINT((ans + MOD) % MOD);
    return 0;
}

Measured memory_bytes: 5196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (ll i = a; i <= b; ++i)
const ll N = 1e5 + 7, mo = 1000000007;

ll n, k; ll res;
vector <ll> e[N];

void dfs(ll u, ll fa) {
	ll p = (u == 1) ? k - 1 : k - 2;
	for (auto v : e[u])	if (v != fa) {
		(res *= (p--)) %= mo;
		dfs(v, u); 
	}
}

int main() {
	scanf("%lld%lld", &n, &k); res = k;
	rep(i, 1, n - 1) {
		ll u, v;
		scanf("%lld%lld", &u, &v);
		e[u].push_back(v);
		e[v].push_back(u);
	}
	dfs(1, 0);
	printf("%lld\n", res);
	return 0;
}


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

typedef long long ll;

#define vi std::vector<int>
#define vl std::vector<ll>
#define in(x, a, b) a <= x && x <= b;
#define tern(b, o1, o2) b ? o1 : o2
#define floop(n) for(int i = 0; i < n; ++i)
#define print(x) std::cout << x << std::endl;

const ll INF = 1e18;

int main()
{
    int n;
    ll N;
    std::string s = "";
    std::cin >> N;

    while(N > 0)
    {
        n = (N % 26)==0 ? 26 : N%26;
        s.insert(0, 1, (char)(n+96));
        N -= n;

        if(N == 0)
        {
            print(s);
            break;
        }

        else
            N /= (ll)(26);
    }
    return 0;
}

Measured memory_bytes: 3612
/*#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include<bits/stdc++.h>
#define ll long long
#define inf 1000000005
#define put putchar('\n')
#define F(i,a,b) for (int i=(a);i<=(b);i++)
#define D(i,a,b) for (int i=(a);i>=(b);i--)
#define go(i,t) for (int i=head[t];i;i=Next[i])
#define sqr(x) ((x)*(x))
#define re register
#define mp make_pair
#define fi first
#define se second
#define pa pair<int,int>
#define pb push_back
#define be begin()
#define en end()
#define ret return puts("-1"),0;
#define mod 1000000007
#define N 500055
#define int ll
using namespace std;
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){char c=getchar();int tot=1;while ((c<'0'|| c>'9')&&c!='-') c=getchar();if (c=='-'){tot=-1;c=getchar();}
int sum=0;while (c>='0'&&c<='9'){sum=sum*10+c-'0';c=getchar();}return sum*tot;}
inline void wr(int x){if (x<0) {putchar('-');wr(-x);return;}if(x>=10)wr(x/10);putchar(x%10+'0');}
inline void wrn(int x){wr(x);put;}inline void wri(int x){wr(x);putchar(' ');}
inline void wrn(int x,int y){wri(x);wrn(y);}inline void wrn(int a,int b,int c){wri(a);wrn(b,c);}
int n,m,ans,sum[N];
map <int,int> f;
signed main(){
	n=read();
	f[0]++;
	F(i,1,n){
		sum[i]=sum[i-1]+read();
		ans+=f[sum[i]]++;
	}
	wrn(ans);
	return 0;
}

Measured memory_bytes: 14336
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,a,b;
cin >>n>>a>>b;
int ans=0;
for(int i=1;i<n+1;i++){
int sum = 0;
int num = i;
while(num/10 >=1){
sum+= num%10;
num = num / 10;
}
sum += num;
if(sum >= a && sum <= b)
ans += i;
}
cout << ans <<endl; 
}



Measured memory_bytes: 3568
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        new Program().Calc();
    }

    Scanner cin;

    public Program() { }

    bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }

    void Calc()
    {
        cin = new Scanner();

        int n = cin.nextInt();
        string s = cin.next();

        char[] s_ = s.ToCharArray();

        for (int i = 0; i < s.Length; ++i)
        {
            int diff = s_[i] - 'A' + n;
            diff %= 26;
            s_[i] = (char)('A' + (char)diff);
        }

        WriteLine(s_);
    }
}

public static class StringExtension
{
    public static char GetChar1(this string str, int indexOneBase)
    {
        return str[indexOneBase - 1];
    }
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


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

using namespace std;
const int maxn = 2e5 + 10;

int main()
{
	int n ;cin >> n;int a[maxn];
	for(int i = 0 ; i < n ; i++) cin >> a[i];
	sort(a,a + n);int f = 1;
	for(int i = 1; i < n ; i++){
		if(a[i] == a[i - 1]){
			f = 0;break;
		}
	}
	if(f == 1) printf("YES\n");
	else printf("NO\n");
}

Measured memory_bytes: 1024
# -*- coding: utf-8 -*-

"""
・ベルマンフォード
"""

import sys
def input(): return sys.stdin.readline().strip()
sys.setrecursionlimit(10 ** 9)

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

edges = [None] * M
for i in range(M):
    a, b, c = map(int, input().split())
    # 0-indexed
    # コストの正負を逆転させれば最短経路問題として処理できる
    edges[i] = (a-1, b-1, -c)

def bellman_ford(N: int, edges: list, start: int) -> list:
    # 頂点[ある始点からの最短距離]
    # (経路自体を知りたい時はここに前の頂点も持たせる)
    verts = [float('inf')] * N
    verts[start] = 0
    # 各辺によるコストの置き換えを頂点数N-1回繰り返す
    for i in range(N-1):
        for src, dest, cost in edges:
            verts[dest] = min(verts[src] + cost, verts[dest])
    # 無限に減らせる場所がないか確認
    for i in range(N):
        for src, dest, cost in edges:
            if verts[src] + cost < verts[dest]:
                verts[dest] = verts[src] + cost
                if dest == N-1:
                    # 頂点Nがそれに該当していたら空リストを返却
                    return []
    # 問題なければ頂点リストを返却
    return verts

verts = bellman_ford(N, edges, 0)
if not verts:
    print('inf')
else:
    # 正負を戻して出力
    print(-verts[N-1])


Measured memory_bytes: 3404
import java.util.*;
import java.io.PrintWriter;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		if(n%10==3){
			System.out.println("bon");
		}else if(n%10==0 || n%10==1 || n%10==6 || n%10==8){
			System.out.println("pon");
		}else{
			System.out.println("hon");
		}
	}
}


Measured memory_bytes: 35572
from collections import defaultdict

n,k=map(int,input().split())
d=defaultdict(int)
for i in range(n):
    a,b=map(int,input().split())
    d[a]+=b
l=sorted(d.keys())
cnt=0
for i in l:
    cnt+=d[i]
    if cnt>=k:
        print(i)
        exit()

Measured memory_bytes: 10856
#include <iostream>
using namespace std;
static const int Max = 100;
static const int Inf = 100000000; // ??????
static const int Nil = -1; // 

enum Status {
	Not_Searched = 0,
	Connected = 1,
	Searched = 2
};

int n;
int M[Max][Max] = {};
Status st[Max] = {}; 
int min_cost[Max] = {}; // min cost of point from start
//int parent[Max] = {}; // ??????index

void dijkstra() {
	for (int i = 0; i < n; i++) {
		min_cost[i] = Inf;
	}

	min_cost[0] = 0;
	st[0] = Connected;
	while (1) {
		int mincost = Inf;
		int min_index = Nil;
		for (int i = 0; i < n; i++) {
			if (st[i] != Searched && mincost > min_cost[i]) {
				mincost = min_cost[i];
				min_index = i;
			}
		}
		if (min_index == Nil) break;
		// index ?????????????????????????????????
		st[min_index] = Searched;
		for (int i = 0; i < n; i++) {
			// min_index ??¨???????????£??????????????????????????????????????????
			if (st[i] != Searched && M[min_index][i] != Inf) {
				if (min_cost[i] > min_cost[min_index] + M[min_index][i]) {
					min_cost[i] = min_cost[min_index] + M[min_index][i];
					st[i] = Connected;
				}
			}
		}
	}
	for (int i = 0; i < n; i++) {
		cout << i << " " << (min_cost[i] == Inf ? -1 : min_cost[i]) << endl;
	}
	return;
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			M[i][j] = Inf;
		}
	}
	for (int i = 0; i < n; i++) {
		int u, k;
		cin >> u >> k;
		for (int j = 0; j < k; j++) {
			int vi, ci;
			cin >> vi >> ci;
			M[i][vi] = ci;
		}
	}
	dijkstra();
	return 0;
}

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

#define repi(i, a, n) for (int i = a; i < (int)(n); ++i)
#define rep(i, n) repi(i, 0, n)
#define all(v) begin(v), end(v)

using ll = long long;

class Block {
 public:
  void Init(int N, int value) {
    A.assign(N, value);
  }

  void Flush() {
    if (!has_mark) {
      return;
    }

    has_mark = false;
    for (int& a : A) {
      a = min(a, mark);
    }
  }

  void Mark(int value) {
    if (!has_mark) {
      mark = value;
      has_mark = true;
    } else {
      mark = min(mark, value);
    }
  }

  void Update(int i, int value) {
    Flush();
    A[i] = min(A[i], value);
  }

  int Get(int i) const {
    if (has_mark) {
      return min(A[i], mark);
    } else {
      return A[i];
    }
  }

 private:
  vector<int> A;
  bool has_mark = false;
  int mark;
};

class Blocks {
 public:
  Blocks(int N, int value) : 
    kBlockSize(max(1, (int) sqrt(N))),
    B((N + kBlockSize - 1) / kBlockSize) {
    for (auto& b : B) {
      b.Init(kBlockSize, value);
    }
  }

  int Get(int idx) const {
    return B[idx / kBlockSize].Get(idx % kBlockSize);
  }

  void Update(int l, int r, int value) {
    int bl = l / kBlockSize;
    int br = r / kBlockSize;

    if (bl == br) {
      B[bl].Flush();
      for (int i = l % kBlockSize; i <= r % kBlockSize; ++i) {
        B[bl].Update(i, value);
      }
      return;
    }

    for (int i = l % kBlockSize; i < kBlockSize; ++i) {
      B[bl].Update(i, value);
    }
    for (int i = 0; i <= r % kBlockSize; ++i) {
      B[br].Update(i, value);
    }
    for (int i = bl + 1; i < br; ++i) {
      B[i].Mark(value);
    }
  }

 private:
  const int kBlockSize;
  vector<Block> B;
};

int main() {
  // freopen("1.txt", "rb", stdin);
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int N, Q;
  cin >> N >> Q;

  ll result = 1LL * (N - 2) * (N - 2);

  Blocks A(N, N - 1), B(N, N - 1);

  rep(q, Q) {
    int type, x;
    cin >> type >> x;
    --x;

    if (type == 1) {
      int value = A.Get(x);
      result -= max(0, value - 1);
      B.Update(0, value, x);
    } else {
      int value = B.Get(x);
      result -= max(0, value - 1);
      A.Update(0, value, x);
    }
  }

  cout << result << '\n';

  return 0;
}


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

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


	for (int i = 0; i < n; ++i) {
		bool ok = true;
		for (int j = i; j < n; j++) {
			if (s[j] != t[j - i]) {
				ok = false;
			}
		}
		if (ok) {
			cout << max(n, n + i) << endl;
			return 0;
		}
	}

	cout << n + n << endl;
	return 0;
}


Measured memory_bytes: 3596
#include <cstdio>
#include <algorithm>
using namespace std;
int n;
int m;
int be[5005],en[5005];
int main()
{
  scanf("%d %d",&n,&m);
  for(int i=1;i<=n;i++)
    {
      scanf("%d",&be[i]);
    }
  for(int i=1;i<=m;i++)
    {
      scanf("%d",&en[i]);
    }
  int ans=0;
  for(int i=1;i<=m;i++)
    {
        int last=i;
	for(int i=1;i<=n;i++)
	  {
	    if(en[last]==be[i])
	      {
		last++;
		if(last==m+1) break;
	      }
	  }
	ans=max(ans,last-i);
    }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 1064
#include<stdio.h>
#include<algorithm>
using namespace std;
int b[11];
char c[11];
int dfs(int a){
	if(a==(1<<9)-1)return 1;
	for(int i=0;i<9;i++){
		if(a&(1<<i))continue;
		for(int j=i+1;j<9;j++){
			if(a&(1<<j))continue;
			for(int k=j+1;k<9;k++){
				if(a&(1<<k))continue;
				bool ok=false;
				if(c[i]==c[j]&&c[j]==c[k]&&b[i]+1==b[j]&&b[j]+1==b[k]){
					int val=dfs(a+(1<<i)+(1<<j)+(1<<k));
					if(val)return 1;
				}
				if(c[i]==c[j]&&c[j]==c[k]&&b[i]==b[j]&&b[j]==b[k]){
					int val=dfs(a+(1<<i)+(1<<j)+(1<<k));
					if(val)return 1;
				}
			}
		}
	}
	return 0;
}
int main(){
	int a;
	scanf("%d",&a);
	while(a--){
		for(int i=0;i<9;i++)scanf("%d",b+i);
		for(int i=0;i<9;i++)scanf("%s",c+i);
		for(int i=0;i<9;i++){
			for(int j=0;j<8;j++){
				if(b[j]>b[j+1]||(b[j]==b[j+1]&&c[j]>c[j+1])){
					int d=b[j];
					b[j]=b[j+1];
					b[j+1]=d;
					char e=c[j];
					c[j]=c[j+1];
					c[j+1]=e;
				}
			}
		}
		printf("%d\n",dfs(0));
	}
}

Measured memory_bytes: 1024
x, y = map(int,input().split())

ans = 0
# 正正
if x >= 0 and y >= 0:
    
    if x <= y:
        ans = abs(x-y)
        print(ans)
        exit()
    else:
        if y != 0:
            print(abs(x-y)+2)
        else:
            print(abs(x - y) + 1)

# 正負
if x >= 0 and y < 0:
    if abs(x) >= abs(y):
        x = x * -1
        ans += 1
        ans += abs(x - y)
        print(ans)
        exit()
    else:
        print(abs(y)-x + 1)
# 負正
if y >= 0 and x < 0:
    print(min(abs(x-y), abs(x*-1 - y)+1))

# 負負
if x < 0 and y < 0:
    if x > y:
        print(abs(x - y)+2)
    else:
        print(abs(x-y))


Measured memory_bytes: 9176
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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








int main(){
    int N, K; std::cin >> N >> K;
    std::vector<int> A(N);
    for(int i(0); i < N; ++i) std::cin >> A[i];
    for(int i(K); i < N; ++i){
        std::cout << ((A[i-K] < A[i]) ? "Yes" : "No") << "\n";
    }
    return 0;
}


Measured memory_bytes: 4052
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))
#define iter(v,ite) for(auto ite=(v).begin();ite!=(v).end();ite++)
#define mimunum(v,x) distance((v).begin(),lower_bound((v).begin(),(v).end(),x))


lli cn[100005];


int n,m,qn;
int dat[100005];
int gone[100005]={};


vector<int> td;

int main(void){
	scanf("%d%d%d",&n,&m,&qn);
	rep(i,qn)scanf("%d",&dat[i]);
	
	int bp=1;
	irep(i,qn){
		int no=dat[i];
		if(!gone[no]){
			td.push_back(no);
			gone[no]=bp;
			bp++;
		}
	}
	
	reg(i,1,m){
		if(!gone[i])td.push_back(i);
	}
	
	/*
	rep(i,m){
		printf("td .. %d\n",td[i]);
	}
	*/
	
	cn[0]=n;
	
	irep(i,qn){
		int no=dat[i],
			p=gone[no];
		if(!cn[p-1])continue;
		cn[p-1]--;
		cn[p]++;
	}
/*
2 3
4
3 2 3 1
*/
	/*
	rep(i,m+1){
		printf("cn[%d] %d\n",i,cn[i]);
	}
	*/
	
	
	int okp=-1;
	int nma=100005;
	irep(i,m){
		if(nma<td[i]){
			okp=i;
			break;
		}
		nma=td[i];
	}
	//printf("%d %d\n",nma,okp);
	
	reg(i,0,okp){
		if(cn[i]>0){
			printf("No\n");
			return 0;
		}
	}
	
	printf("Yes\n");
	return 0;
}






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

class Program
{
    int n;
    List<Tuple<long, long>> l;
    void Run()
    {
        var sc = new Scanner();
        n = sc.NextInt();
        l = new List<Tuple<long, long>>();
        long[] a = new long[n];
        long[] b = new long[n];
        int init = 0;
        for (int i = 0; i < n; i++)
        {
            long x = sc.NextLong();
            long y = sc.NextLong();
            l.Add(Tuple.Create(x, y));
            a[i] = x;
            b[i] = y;
            if (i > 0 && (x < l[init].Item1 || y < l[init].Item2)) init = i;
        }
        if (n == 1)
        {
            Console.WriteLine(1);
            return;
        }
        Array.Sort(a);
        Array.Sort(b);
        var ds = new Dictionary<Tuple<long, long>, int>();
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < n; j++)
            {
                if (i == j) continue;
                var d = Tuple.Create(l[j].Item1 - l[i].Item1, l[j].Item2 - l[i].Item2);
                if (!ds.ContainsKey(d)) ds.Add(d, 0);
                ds[d]++;
            }
        }
        var dd = ds.OrderByDescending(p => p.Value).First().Key;

        bool[,] map = new bool[n, n];
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
            {
                if (i == j) continue;
                if (l[i].Item1 - dd.Item1 == l[j].Item1 && l[i].Item2 - dd.Item2 == l[j].Item2)
                {
                    map[i, j] = true;
                    map[j, i] = true;
                }
            }
        int c = 0;
        bool[] visit = new bool[n];
        for (int i = 0; i < n; i++)
        {
            if (visit[i]) continue;
            c++;
            var q = new Queue<int>();
            q.Enqueue(i);
            while (q.Count > 0)
            {
                int x = q.Dequeue();
                if (visit[x]) continue;
                visit[x] = true;
                for (int j = 0; j < n; j++)
                {
                    if (map[x, j]) q.Enqueue(j);
                }
            }
        }
        Console.WriteLine(c);
    }


    static void Main(string[] args)
    {
        new Program().Run();
    }

    static long Gcd(long a, long b)

    {
        if (a < b) return Gcd(b, a);
        if (b == 0) return a;
        return Gcd(b, a % b);
    }
}

class Scanner
{
    int index = -1;
    string[] buf;

    public Scanner()
    {
    }

    public int NextInt()
    {
        CheckNext();
        return int.Parse(buf[index++]);
    }

    public long NextLong()
    {
        CheckNext();
        return long.Parse(buf[index++]);
    }

    public double NextDouble()
    {
        CheckNext();
        return double.Parse(buf[index++]);
    }

    public string NextString()
    {
        CheckNext();
        return buf[index++];
    }

    private void CheckNext()
    {
        if (index >= 0 && index < buf.Length) return;

        buf = Console.ReadLine().Split(' ');
        index = 0;
    }
}


Measured memory_bytes: 13920
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

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

__attribute__((constructor)) void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int cnt[50][1000] = {0};
int minCnt[1000] = {};

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

    rep(j, 1000) {
        minCnt[j] = INF;
    }

    rep(i, N) {
        string S;
        cin >> S;
        rep (j, S.size()) {
            cnt[i][S[j]]++;
        }
        for (char c = 'a'; c <= 'z'; c++) {
            minCnt[c] = min(minCnt[c], cnt[i][c]);
            // DEBUG(c);
            // DEBUG(cnt[i][c]);
            // DEBUG(minCnt[c]);
            // cout << "------------" << endl;
        }
    }

    for (char c = 'a'; c <= 'z'; c++) {
        // DEBUG(c);
        // DEBUG(minCnt[c]);
        // cout << "------------" << endl;
        int mc = minCnt[c];
        rep (i, mc) {
            cout <<  c;
        }
    }
    cout << endl;
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main()
{
	int k,g=0,o=0;
	cin>>k;
	for(int i=1;i<=k;i++)
	{
		if(i%2==0)
			g++;
		else
			o++;
	}
	cout<<g*o<<endl;
	return 0;
}

Measured memory_bytes: 256
from collections import deque

N, M = map(int, input().split())
d = {i:[] for i in range(1, N+1)}
for _ in range(M):
    A, B = map(int, input().split())
    d[A].append(B)
    d[B].append(A)

par = [-1]*(N+1)
par[1] = 0

q = deque([1])
while q:
    a = q.popleft()
    for b in d[a]:
        if par[b]!=-1:continue
        par[b] = a
        q.append(b)

print("Yes")
for i in range(2, N+1):
    print(par[i])


Measured memory_bytes: 41580
D = gets.to_i
C,*S = (0..D).map{gets.split.map &:to_i}
R,L,M,N = 0..25,[-1]*26,2,10
T = (1..N).map {L.dup}
def F(d,n)
  n = D-d if n > D-d
  s,t = S[d],T[-n]
  i = R.max_by(M){|i| t[i] = n*C[i]*(d-L[i]) + s[i] }
  x = t[i[0]]
  i = n < 2 ? i[0] : i.max_by {|i|
    l,L[i] = L[i],d
    c = t[i] + (F(d+1,n-1)>>5)
    L[i] = l
    x < c ? x=c : c
  }
  (x<<5) + i
end
D.times { p 1+i=F(_1,N)&31; L[i]=_1 }

Measured memory_bytes: 14572
n,d = map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]
import numpy as np 
z = np.array(x)
count = 0
for i in range(n):
    for j in range(i+1,n):
        distance = np.linalg.norm(z[i]-z[j])
        if distance.is_integer():
            count += 1
print(count)


Measured memory_bytes: 12416
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
typedef long long ll;
const int Imx=2147483647;
const ll Lbig=2e18;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it,len;
	fastio(){it=len=0;}
	inline char get()
	{
		if(it<len)return s[it++];it=0;
		len=fread(s,1,100000,stdin);
		if(len==0)return EOF;else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while(c==' '||c=='\n')c=get();
		if(it>0)it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0;bool ng=0;char c;c=_buff.get();
	while(c!='-'&&(c<'0'||c>'9'))c=_buff.get();
	if(c=='-')ng=1,c=_buff.get();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=_buff.get();
	return ng?-r:r;
}
template<class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline char getreal(){char c=_buff.get();while(c==' '||c=='\n')c=_buff.get();return c;}
int n,m;
int px[100111],py[100111],ans;
bool used[411],f[411];
bool s[411][411];
bool vis[200111];
bool OK;
void go(int x)
{
	memset(used,0,sizeof(used));
	f[x]=1;
	for(int i=m;i>=1;i--)
	{
		bool tx=px[i]==x||used[px[i]];
		bool ty=py[i]==x||used[py[i]];
		if(tx&&ty)f[x]=0;
		if(tx)used[py[i]]=1;
		if(ty)used[px[i]]=1;
	}
	f[x]&=s[x][x]==0;
	for(int i=1;i<=n;i++)s[x][i]=used[i];
}
int main()
{
	getii(n,m);
	for(int i=1;i<=m;i++)
	{
		getii(px[i],py[i]);
	}
	for(int i=1;i<=n;i++)go(i);
	for(int i=1;i<=n;i++)
	{
		if(!f[i])continue;
		for(int j=i+1;j<=n;j++)
		{
			if(!f[j]||s[i][j]||s[j][i])continue;
			bool ok=1;
			for(int k=1;k<=n;k++)
			{
				if(s[i][k]&&s[j][k])
				{
					ok=0;
					break;
				}
			}
			ans+=ok;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int main()
{ long long n,a,b,x;
cin>>n>>a>>b;
if((n*a)<b)
x=n*a;
if((n*a)>b) x=b ;
if((n*a)== b) x=b;

cout << x << "\n" ;

    return 0;
}


Measured memory_bytes: 3628
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


h,w = list(map(int, input().split()))
n = h*w
a = [None]*h
b = [None]*h
for i in range(h):
    a[i] = list(map(int, input().split()))
for i in range(h):
    b[i] = list(map(int, input().split()))
# for i in range(h):
#     for j in range(h):
dp = [[None]*(w) for _ in range(h)]
mask = (1<<12800)-1
m = 6400
dp[0][0] = 1<<(a[0][0]-b[0][0]+m) | 1<<(b[0][0]-a[0][0]+m)
for i in range(h):
    for j in range(w):
        if i==j==0:
            continue
        v = abs(a[i][j]-b[i][j])
        bit = 0
        if i>0:
            bit |= (dp[i-1][j]<<v)&mask
            bit |= (dp[i-1][j]>>v)
        if j>0:
            bit |= (dp[i][j-1]<<v)&mask
            bit |= (dp[i][j-1]>>v)
        dp[i][j] = bit
# ans = min(abs(item) for item in dp[h-1][w-1])
ans = min(abs(val-m) for val in range(12800) if dp[h-1][w-1]>>val&1)
print(ans)

Measured memory_bytes: 83832
from itertools import accumulate
from bisect import bisect
N = int(input())
X = list(map(int, input().split()))
mod = 10**9+7
T = [2 + i - (1+x)//2 for i, x in enumerate(X)]
T = list(accumulate(T, max))
D = [min(1 + bisect(T, i), N) - i + 1 for i in range(1, N + 1)]
ans = 1
for d in D:
    ans = (ans * d)%mod
print(ans)

Measured memory_bytes: 14484
from collections import deque
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)


def inpl():
    return list(map(int, input().split()))


def bfs():
    visited[0] = True
    ans[0] = counter[0]
    deq = deque()
    deq.append(0)
    while deq:
        v = deq.popleft()
        for nv in edge[v]:
            if visited[nv] is True:
                continue
            visited[nv] = True
            ans[nv] = ans[v] + counter[nv]
            deq.append(nv)


N, Q = inpl()

edge = [[] for i in range(N)]
for i in range(N - 1):
    a, b = inpl()
    edge[a - 1].append(b - 1)
    edge[b - 1].append(a - 1)

counter = {k: 0 for k in range(N)}
for i in range(Q):
    p, q = inpl()
    counter[p - 1] = counter.get(p - 1, 0) + q

ans = [0] * N
visited = [False] * N

bfs()

print(" ".join(list(map(str, ans))))


Measured memory_bytes: 99836
using System;

namespace _126A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] NM = Console.ReadLine().Split(' ');
            int N = int.Parse(NM[0]);
            int K = int.Parse(NM[1]);
            string S = Console.ReadLine();
            Console.WriteLine("{0}{1}{2}", S.Substring(0, K - 1), S.Substring(K - 1, 1).ToLower(), S.Substring(K, N - K));
        }
    }
}


Measured memory_bytes: 11092
/*input
3 7
1 6 3
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}

int main()
{
	int n;
	cin>>n;
	double ans=0;
	while(n--){
		double d;
		string s;
		cin>>d>>s;
		if(s[0]=='J') ans+=d;
		else ans+=d*380000;
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
import math
def isprime(n):
    if n==1:return(False)
    if n==2:return(True)
    for i in range(2,int(math.sqrt(n))+1):
        if n%i==0:return(False)
    return(True)
n=int(input())
for i in range(n,10**6):
    if isprime(i):
        print(i)
        exit()

Measured memory_bytes: 38640
T = input()
# T = 'PD?D??P'
# T = 'P?P?'

ans = ''
n = 0

T2 = T.replace('?', 'D')
d = T2.count('D')
pd = T2.count('PD')
if n < d+pd:
    n = d+pd
    ans = T2

T2 = T.replace('?D', 'PD')
T2 = T2.replace('?', 'D')
d = T2.count('D')
pd = T2.count('PD')
if n < d+pd:
    n = d+pd
    ans = T2

print(ans)


Measured memory_bytes: 64336
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pi acos(-1)
#define pb push_back
#define all(v) v.begin(),v.end()
using namespace std;
typedef pair<int,int> p;
typedef long long ll;

int main(){
	string c[2];
	rep(i,2)cin>>c[i];
	bool check=true;
	rep(i,2)rep(j,3){
		if(c[i][j]==c[1-i][2-j])continue;
		check=false;
		break;
	}
	cout<<((check)?"YES":"NO")<<endl;
	return 0;
}

Measured memory_bytes: 256
import math
import collections
import fractions
import itertools
import functools
import operator

def solve():
    l, r, d = map(int, input().split())
    ans = 0
    for i in range(l, r+1):
        if i % d == 0:
            ans += 1
    print(ans)
    return 0

if __name__ == "__main__":
    solve()


Measured memory_bytes: 10448
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <tuple>

#include <set>
#include <unordered_map>
#include <stack>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
template<class T>bool chmaxj(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; }
void YesNo(bool y) { cout << (y ? "Yes" : "No") << endl; } //true==yes


#define INF 21474836

//////////////////////////////////////////////////////////////


int main() {

	int N, M;
cin >> N >> M;
	vector<int> A(N);
	
	rep(i, N)cin >> A[i];

	int Sum = 0;
	rep(i, N)Sum += A[i];

	int ans = 0;
	rep(i, N) {
		if (Sum <= 4 * M * A[i])ans++;
	}

	YesNo(ans>=M);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef vector<int> vec1;
typedef vector<string> vec2;
typedef vector<double> vec3;

int main() {
  
  int n;
  cin >> n;
  vec1 a(n);
  for(int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  int ans = a.at(n-1) - a.at(0);
  cout << ans << endl;
}

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

using int64 = long long;
using uint64 = unsigned long long;

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

    int N;
    cin >> N;

    set<string> S;
    char last;
    for (int i = 0; i < N; i++)
    {
        string w;
        cin >> w;

        if (i > 0 and (last != w[0] or S.count(w) > 0))
        {
            cout << "No" << endl;
            return 0;
        }
        last = w.back();
        S.insert(w);
    }
    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 256