akhauriyash/Code-Regression huggingface dataset:
N = int(input())

S = input()

x = 0

Ans = [0]

for i in range(N):
	if S[i] == "I":
		Ans.append(Ans[i] + 1)
	if S[i] == "D":
		Ans.append(Ans[i] - 1)

print(max(Ans))

Measured memory_bytes: 3060
if __name__ == '__main__':
    a, b, c = [int(x) for x in input().split()]
    combos = [a+b, a+c, b+c]
    ans = False
    for num in combos:
        if num == a or num == b or num == c:
            ans = True
    if ans:
        print('Yes')
    else:
        print('No')

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

#define fr(i,n) _back
#define pb	push_back
#define eb	emplace_back
#define mk	make_pair
#define fi	first
#define se	second
#define endl	'\n'

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const int T = 2e5 + 3;

int pai[3][T];
int peso[3][T];
vii g[T];
int n,k,l;

void init() {
    for(int i = 0; i < 3; i++)
        for(int j = 0; j <= n; j++) {
            pai[i][j] = j;
            peso[i][j] = 1;
        }
}

int find(int op, int x) {
    return (pai[op][x] == x? x : pai[op][x] = find(op,pai[op][x]));
}

void join(int op, int x, int y) {
    x = find(op,x);
    y = find(op,y);
    if(x == y) return;
    if(peso[op][x] < peso[op][y]) swap(x,y);
    pai[op][y] = x;
    peso[op][x] += peso[op][y];
}

int main() {
    ios_base::sync_with_stdio(false);
    cin >> n >> k >> l;
    init();

    while(k--) {
        int a,b; cin >> a >> b;
        if(find(0,a) != find(0,b)) join(0,a,b);
    }

    while(l--) {
        int a,b; cin >> a >> b;
        if(find(1,a) != find(1,b)) join(1,a,b);
    }

    for(int i = 1; i <= n; i++)
        g[find(0,i)].eb(find(1,i),i);

    for(int i = 1; i <= n; i++) {
        sort(g[i].begin(), g[i].end());
        for(int j = 1; j < g[i].size(); j++)
            if(g[i][j].fi == g[i][j-1].fi)
                join(2,g[i][j].se,g[i][j-1].se);
    }

    for(int i = 1; i <= n; i++) cout << peso[2][find(2,i)] << " ";
    cout << endl;

    return 0;
}



Measured memory_bytes: 15744
// This template belongs to Juan Carlo Vieri

/*   ____   __
    /  _/  |  |    __         __
 __|  |__  |  |   /_/        |  |
|__    __| |  |   __    ____ |  | __   ___   _  ___
   |  |    |  |  |  |  /  _/ |  |/ /  / _ \ | |/ _/
   |  |    |  |  |  | |  |_  |     \ |  __/ |   /
   |__|    |__|  |__|  \___\ |__|\__\ \___\ |__|
*/

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

typedef int_fast64_t ll;
typedef long double ld;
typedef int_fast32_t intt;
typedef int_fast32_t tmp_m;
#define deb(x) cout << #x << ' ' << x << endl
#define rep(i, cmp1, cmp2) for (tmp_m i = cmp1; i < cmp2; ++i)
#define repp(i, cmp1, cmp2) for (tmp_m i = cmp1; i >= cmp2; --i)
#define pb push_back
#define st stack
#define pa pair
#define vc vector
#define qu queue
#define pq priority_queue
#define fr first
#define sc second
#define mp map
const ld pi = acos(-1.0);
const intt mod = 1e9 + 7;

struct pr {
  intt x;
  intt y;
  intt dst;
  pr() {}
  pr(intt x, intt y, intt dst) : x(x), y(y), dst(dst) {}
  inline bool operator<(const pr& cmp2) const {
    if (dst != cmp2.dst) return dst < cmp2.dst;
    if (x != cmp2.x) return x < cmp2.x;
    return y < cmp2.y;
  }
  inline bool operator==(const pr& cmp2) const {
    return (cmp2.dst == dst) && (cmp2.x == x) && (cmp2.y == y);
  }
  inline bool operator>(const pr& cmp2) const {
    if (dst != cmp2.dst) return dst > cmp2.dst;
    if (x != cmp2.x) return x > cmp2.x;
    return y > cmp2.y;
  }
};

struct point {
  intt x;
  intt y;
  point() {}
  point(intt x, intt y) : x(x), y(y) {}
  inline bool operator<(const point& cmp2) const {
    if (cmp2.x != x) return cmp2.x < x;
    return cmp2.y < y;
  }
  inline bool operator==(const point& cmp2) const {
    return (cmp2.x == x) && (cmp2.y == y);
  }
  inline bool operator>(const point& cmp2) const {
    if (cmp2.x != x) return cmp2.x > x;
    return cmp2.y > y;
  }
};

class prHash {
 public:
  size_t operator()(const pr& cmp1) const {
    return (hash<intt>()(cmp1.x)) ^ (hash<intt>()(cmp1.y)) ^
           (hash<intt>()(cmp1.dst));
  }
};

class pointHash {
 public:
  size_t operator()(const point& cmp1) const {
    return (hash<intt>()(cmp1.x)) ^ (hash<intt>()(cmp1.y));
  }
};

inline bool spoint(const point& cmp1, const point& cmp2) {
  // swap(cmp1, cmp2);
  if (cmp1.x != cmp2.x) return cmp1.x < cmp2.x;
  return cmp1.y < cmp2.y;
}

inline bool spr(const pr& cmp1, const pr& cmp2) {
  // swap(cmp1, cmp2);
  if (cmp1.dst != cmp2.dst) return cmp1.dst < cmp2.dst;
  if (cmp1.x != cmp2.x) return cmp1.x < cmp2.x;
  return cmp1.y < cmp2.y;
}

void sub() {

}

void solve() {
  // intt t; cin >> t;
  // while (t--) sub();
  intt a, b;
  cin >> a >> b;
  cout << a * b << endl;
}

void init() {
  // remove if interactive
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  srand(time(0));
  // memset(dp, -1, sizeof dp);
}

int main() {
  init();
  solve();
  return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
// BE READY FOR THE NEXT :) 
using namespace std ;
int main()
{
string s;
	cin >> s;

	if(s == "SAT"){cout << 1;}
	else if(s == "SUN") {cout << 7;}
	else if(s == "MON") {cout << 6;}
	else if(s == "TUE") {cout << 5;}
	else if(s == "WED") {cout << 4; }
	else if(s == "THU") {cout << 3;}
	else if(s == "FRI") {cout << 2;}
	return 0 ;
}


Measured memory_bytes: 256
# coding: utf-8

n = int(input())
A = list(map(int, input().split()))
print(" ".join(map(str,A)))

for i in range(1,n):
    v = A[i]
    j = i -1
    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print(" ".join(map(str,A)))


Measured memory_bytes: 5600
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);
		int[] num = new int[3];
		for(int i=0;i<3;i++)num[i]=sc.nextInt();
		Arrays.sort(num);
		sc.close();
		int cnt = 0;
		for(;num[1]<num[2];) {
			num[0]++;num[1]++;
			cnt++;
		}
		for(;num[0]<num[2];) {
			num[0]+=2;
			cnt++;
		}
		for(;num[0]>num[1];) {
			num[1]++;num[2]++;
			cnt++;
		}
		System.out.println(cnt);
	}
}

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

int main() {
  int a, b;
  cin >> a >> b;

  if (b == 1) {
    cout << "0" << endl;
    return 0;
  }

  int i = 1;

  while (1) {
    if (a * i - (i - 1) >= b) {
      cout << i << endl;
      return 0;
    }
    i++;
  }
}

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

int main() {
  int n,n1,n2,n3,n4;
  string a = "No";
  cin >> n;
  n1 = n/1000;
  n2 = (n%1000)/100;
  n3 = (n%100)/10;
  n4 = n%10;
  if (n1 == n2 && n2==n3) a = "Yes";
  else if (n2 == n3 && n3 == n4) a = "Yes";
  cout << a << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define x first
#define y second
#define gcd(x, y) __gcd((x), (y))
using namespace std;

using i64 = long long;
using pii = pair<int, int>;

int n;

vector<pii> ant;
vector<int> v;

void add(int a, int b) {
	ant.emplace_back(a, b);
	ant.emplace_back(a, b); }

int main() {
#ifdef HOME
	freopen("atc.in", "r", stdin);
	freopen("atc.out", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int src(0);

	cin >> n, v.resize(n);
	for (auto &i: v)
		cin >> i;

	for (int i = 1; i < n; ++i)
		if (abs(v[i]) > abs(v[src]))
			src = i;

	if (v[src] == 0) {
		cout << "0\n";
		return 0; }
	else if (v[src] > 0) {
		add(src, 0);
		for (int i = 1; i < n; ++i)
			add(i - 1, i); }
	else {
		add(src, n - 1);
		for (int i = n - 1; i > 0; --i)
			add(i, i - 1); }

	cout << ant.size() << endl;
	for (auto i: ant)
		cout << ++i.x << ' ' << ++i.y << '\n';

	return 0; }


Measured memory_bytes: 256
/// Code By t_bone_289 (Tushar Singh)
/// An Immature Programmer.... I'm still developing !!
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define M 1000000007
#define error(x) cout << #x << " = " << x << endl;
#define pi 3.14159265358979323846
typedef long long ll;
typedef long double ld;
template <typename T>
void ContainerError(T &v){cout<<"{";for(auto &x:v){cout<<x<<',';}cout<<"}"<<endl;return;}
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
ll mpow(ll base,ll exp){ll res=1;while(exp>0){if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return (res);}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll ans = 1;
    for(ll i=1;i<n;i++)
    {
        if(s[i]!=s[i-1])
        {
            ans++;
        }
    }
    cout<<ans;
    return 0;
}



Measured memory_bytes: 512
n  = gets.to_i
bs = gets.split.map(&:to_i)

as = Array.new(n, 0)
as[0] = bs[0]
(1..n-2).each do |i|
  as[i] = [bs[i-1], bs[i]].min
end
as[n-1] = bs[n-2]

puts as.inject(:+)



Measured memory_bytes: 1788
while True:
    H,W=map(int,input().split())
    if H==0 and W==0:
        break
    else:
        print("#"*W)
        for i in range(1,H-1):
            print("#",end="")
            print("."*(W-2),end="")
            print("#")
        print("#"*W)
        print()


Measured memory_bytes: 5632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main(){
    ll r,g,b,n; cin>>r>>g>>b>>n;
    ll res=0;
    for(ll i=0; i<=n/r; i++){
        for(ll j=0; j<=n/g; j++){
            if((n-i*r-j*g)>=0 && (n-i*r-j*g)%b==0){
                res++;
                //cout<<i<<' '<<j<<' '<<n-i-j<<endl;
            }
        }
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
	int s;
	cin >> s;
	if (s / 100 >= 1 && s / 100 <= 12 
	&& s % 100 >= 1 && s % 100 <= 12) {
		cout << "AMBIGUOUS" << endl;
	}
	else if (s / 100 >= 1 && s / 100 <= 12) {
		cout << "MMYY" << endl;
	}
	else if (s % 100 >= 1 && s % 100 <= 12) {
		cout << "YYMM" << endl;
	}
	else {
		cout << "NA" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<long, long>
#define ff first
#define ss second
#define pb push_back


main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N; cin >> N;
    if(!(N % 1000)) cout << 0;
    else cout << 1000-(N%1000);
}


Measured memory_bytes: 3664
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long a, b;
    cin >> a >> b;
    cout << ceil((a+b)/2.0) << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 3768
n,h = map(int,input().split())
a,b = map(int,input().split())
M = a
throw = [b]
for i in range(1,n):
    x,y = map(int,input().split())
    if M < x:
        M = x
    throw.append(y)
throw.sort(reverse=True)
i = 0
while throw[i] > M:
    h -= throw[i]
    i += 1
    if h <= 0:
        print(i)
        exit()
    elif i == n:
        break
if h%M == 0:
    i += h//M
else:
    i += h//M + 1
print(i)

Measured memory_bytes: 7384
#include<bits/stdc++.h>
using namespace std;
int n,capa;
int v[1000],w[1000];
int memo[101][10001];

int solve(int idx, int remain);

int main()
{
   cin >> n >> capa;
   for(int i = 0;i < n;i++){
     cin >> v[i] >> w[i];
   }
   memset( memo, -1, sizeof(memo));
   cout << solve(0,capa) << endl;
}

int solve(int idx, int remain)
{
  if(idx == n)return 0;
  if(memo[idx][remain] != -1)return memo[idx][remain];

  int rec = 0;
  if(remain >= w[idx]){
    rec = max(solve(idx + 1, remain - w[idx]) + v[idx], solve(idx, remain - w[idx]) + v[idx]);
  }
  rec = max(rec, solve(idx + 1, remain));
  return memo[idx][remain] = rec;
}

Measured memory_bytes: 5592
class UnionFind
	def initialize
		@node = []
	end

	class Node
		def initialize(obj)
			@obj = obj
			@parent = self
			@dw = 0
		end

		attr_accessor :parent, :dw
	end

	def union(x, y, dw0)
		u, dw1 = root_and_dw(@node[x] ||= Node.new(x))
		v, dw2 = root_and_dw(@node[y] ||= Node.new(y))
		return if u == v
		v.parent, v.dw = u, dw0 + dw1 - dw2
	end

	def weight_diff(x, y)
		return nil unless u = @node[x]
		return nil unless v = @node[y]
		r1, dw1 = root_and_dw(u)
		r2, dw2 = root_and_dw(v)
		return nil if r1 != r2
		dw2 - dw1
	end
end

def root_and_dw(u)
	return [u, 0] if u.parent == u
	path = [u]
	path << path[-1].parent until path[-1].parent == path[-1]
	root = path[-1]
	dw = 0
	until path.empty?
		v = path.pop
		v.parent, v.dw = root, dw += v.dw
	end
	[root, u.dw]
end	


loop do
	n, m = gets.split.map &:to_i
	break if n == 0
	uf = UnionFind.new

	m.times do
		q, a, b, dw = gets.chomp.split
		a, b = a.to_i, b.to_i
		if q == ?!
			uf.union(a, b, dw.to_i)
		else
			dw = uf.weight_diff(a, b)
			puts dw ? dw : 'UNKNOWN'
		end
	end
end

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


int main() {
  int X , Y , Z ; 
  cin >> X ; 
  Z = 0 ;
  Y = 0 ; 
  
  while( X >= 500){
    X = X - 500 ; 
    Z++ ;
  }
  
  while(X >= 5 ){
    X = X - 5 ; 
    Y++ ; 
  }
  
  cout << 1000*Z + 5*Y << endl ; 
  
  
  
}



Measured memory_bytes: 3632
import sys
a,b = map(int,input().split())
s = input()
if s[a] == '-':
    s = s.replace(s[a],'',1)
    if s.isdecimal():
        print('Yes')
        sys.exit()
    else:
        print('No')
        sys.exit()
else:
  print('No')


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

using namespace std;
#define sync   freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);freopen("error.txt","w",stderr);
#define ll long long
const unsigned int M = 1000000007;
int main(){
	
	int n;
	cin>>n;
	
	vector<double> dp(n+1);
	//dp[head] probblity of havig i heads dp[i]
	dp[0]=1;
	for(int i=0;i<n;i++){
		double p;
		cin>>p;
		for(int head=i+1;head>=0;head--){
			dp[head]= dp[head-1]*p+(1-p)*dp[head];

		}
	}
	double ans=0;
	for(int head=0;head<=n;head++){
		// cout<<dp[head];
		if(head> n-head )ans+=dp[head];
	}
	printf("%.10lf",ans);
}

Measured memory_bytes: 3724
#include<stdio.h>
int main(void){

	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	int x=0;
	for(int i=a;i<=b;i++){
	if(c%i==0)x++;
	}
	printf("%d\n",x);
	return 0;
}

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

int main()
{
    int N;
    int D_1[100], D_2[100];
    int flag = 0;

    cin >> N;
    for (int i = 0; i <= N - 1; i++)
    {
        cin >> D_1[i] >> D_2[i];

        if (i >= 2)
        {
            if ((D_1[i - 2] == D_2[i - 2]) && (D_1[i - 1] == D_2[i - 1]) && (D_1[i] == D_2[i]))
            {
                flag = 1;
                cout << "Yes" << endl;
                break;
            }
        }
    }
    if (flag == 0)
        cout << "No" << endl;
}

Measured memory_bytes: 3136
#include<queue>
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<limits.h>
#include<utility>
#include<vector>
#include<tuple>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(A) A.begin(),A.end()
ll gcd(ll a, ll b) {
	if (a < b) {
		ll tmp = a;
		a = b;
		b = tmp;
	}
	ll r = a % b;
	if (r == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}
int main() {
	ll n;
	cin >> n;
	vector<ll> D(1000001);
	vector<ll> prime(0);
	/*for (ll i = 2; i < 1000001; i++) {
		bool tmp = true;
		for (ll p : prime) {
			if (i % p == 0)tmp = false;
		}
		if (tmp)prime.push_back(i);
	}*/
	vector<bool> ans(1000001,false);
	rep(i, 1000001) {
		D[i] = i;
	}
	for (int i = 2; i * i < 1000000; i++) {
		if (D[i] == i) {
			for (ll j = i * i; j <= 1000000; j+=i) {
				if (D[j] == j)D[j] = i;
			}
		}
	//	cout << i << ":" << D[i] << endl;
	}
	vector<ll> a(n);
	bool pairwise = true;
	ll GCD ;
	rep(i, n) {
		cin >> a[i];
		if (i == 0)GCD = a[i];
		if (i > 0)GCD = gcd(a[i], GCD);
		ll A = a[i];
		while (A != 1) {
			if (ans[D[A]])pairwise = false;
			ans[D[A]] = true;
			ll d = D[A];
			while (A % d == 0) {
				A /= d;
			}
		}
	}
	//cout << GCD << endl;
	if (pairwise) {
		cout << "pairwise coprime" << endl;
	}
	else if(GCD==1){
		cout << "setwise coprime" << endl;
	}
	else {
		cout << "not coprime" << endl;
	}
}


Measured memory_bytes: 18600
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define pp pop_back
#define in insert
#define ff first
#define ss second
#define e endl
#define debug cout<<"we are debuuging"<<endl;
#define MOD 998244353
ll fast_expo(ll x,ll p)
{if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
int main()
{
     int a,b;
     cin>>a>>b;
     cout<<a*b;
}


Measured memory_bytes: 3620
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		new Main().solver();
	}

	void solver() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] x = new int[n];
		int[] y = new int[n];
		for (int i = 0; i < n; i++) {
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
		}
		PriorityQueue<Edge> edges = new PriorityQueue<>();
		for (int i = 0; i < m; i++) {
			int p = sc.nextInt() - 1;
			int q = sc.nextInt() - 1;
			edges.add(new Edge(p, q, (x[p] - x[q]) * (x[p] - x[q]) + (y[p] - y[q]) * (y[p] - y[q])));
		}
		System.out.println(MST(edges,n));
	}

	double MST(PriorityQueue<Edge> edges,int n) {
		DJSet ds = new DJSet(n);
		double ans = 0;
		while (!edges.isEmpty()) {
			Edge e = edges.poll();
			if (!ds.same(e.dst, e.src)) {
				ds.setUnion(e.dst, e.src);
			} else {
				ans += Math.sqrt(e.weight);
			}
		}
		return ans;
	}

	class Edge implements Comparable<Edge> {
		int src;
		int dst;
		long weight;

		Edge(int src, int dst, long weight) {
			this.src = src;
			this.dst = dst;
			this.weight = weight;
		}

		@Override
		public int compareTo(Edge o) {
			return -Long.compare(this.weight, o.weight);
		}
	}

	class DJSet {
		int n;
		int[] s;

		public DJSet(int n) {
			this.n = n;
			s = new int[n];
			Arrays.fill(s, -1);
		}

		int find(int x) {
			if (s[x] < 0) {
				return x;
			} else {
				return find(s[x]);
			}
		}

		boolean same(int x, int y) {
			return find(x) == find(y);
		}

		boolean setUnion(int x, int y) {
			if (find(x) != find(y)) {
				x = find(x);
				y = find(y);
				if (count(x) < count(y)) {
					int tmp = x;
					x = y;
					y = tmp;
				}
				s[x] += s[y];
				s[y] = x;
				return true;
			} else {
				return false;
			}
		}

		int count(int x) {
			return -s[find(x)];
		}

		int size() {
			int count = 0;
			for (int i = 0; i < n; i++) {
				if (s[i] < 0) {
					count += -s[i];
				}
			}
			return count;
		}
	}
}

Measured memory_bytes: 68288
#include <iostream>

int main(){
    int a[2];
    std::cin >> a[0];
    std::cin >> a[1];
    if(a[0]*a[1]%2==0){
        std::cout << "Even\n";
    }else{
        std::cout << "Odd\n";
    }
    return 0;
}

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

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 2147483647;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
struct RMQ{
  vector<int> data;
  int N;
  RMQ(int n){
    N = 1;
    while(N < n) N *= 2;
    data = vector<int>(2 * N, INF);
  }
  void update(int k, int x){
    k += N - 1;
    data[k] = x;
    while(k > 0){
      k = (k - 1) / 2;
      data[k] = min(data[2 * k + 1], data[2 * k + 2]);
    }
  }
  int query(int a, int b){
    return query(a, b, 0, 0, N);
  }
  int query(int a, int b, int k, int l, int r){
    if(b <= l || r <= a) return INF;
    if(a <= l && r <= b){
      return data[k];
    }else{
      return min(query(a, b, 2 * k + 1, l, (l + r) / 2), query(a, b, 2 * k + 2, (l + r) / 2, r));
    }
  }
};

int main(){
  int H, W, Q;
  while(cin>>H>>W>>Q && H){
    if(H < W){
      //HlogW * Q = 10^7log10^3
      vector<RMQ> rmq(H, RMQ(W));
      REP(y, H){
        REP(x, W){
          int t; scanf("%d", &t);
          rmq[y].update(x, t);
        }
      }
      REP(i, Q){
        int y1, x1, y2, x2;
        scanf("%d %d %d %d", &y1, &x1, &y2, &x2);
        int res = INF;
        for(int y = y1; y <= y2; y++){
          res = min(res, rmq[y].query(x1, x2 + 1));
        }
        printf("%d\n", res);
      }
    }else{
      //WlogH * Q
      vector<RMQ> rmq(W, RMQ(H));
      REP(y, H){
        REP(x, W){
          int t; scanf("%d", &t);
          rmq[x].update(y, t);
        }
      }
      REP(i, Q){
        int y1, x1, y2, x2;
        scanf("%d %d %d %d", &y1, &x1, &y2, &x2);
        int res = INF;
        for(int x = x1; x <= x2; x++){
          res = min(res, rmq[x].query(y1, y2 + 1));
        }
        printf("%d\n", res);
      }
    }
  }
  return 0;
}

Measured memory_bytes: 17492
n = int(input())
testimony = []

for _ in range(n):
    a = int(input())
    tmp = []
    for _ in range(a):
        x, y = map(int, input().split())
        x -= 1
        tmp.append((x, y))
    testimony.append(tmp)

ans = 0
for p in range(2 ** n):
    cnt = 0
    is_unmatch = False
    for i in range(n):
        if p >> i & 1:
            cnt += 1
            for x, y in testimony[i]:
                if p >> x & 1 != y:
                    is_unmatch = True
                    break
        if is_unmatch:
            cnt = 0
            break
    ans = max(ans, cnt)

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
 
int main(){
    int A[3][3];
    rep(i, 3)rep(j, 3) cin>>A[i][j];
    int n;
    cin >> n;
    int B;
    int ok[3][3]={0};
    rep(i, n){
        cin >> B;
        rep(j, 3)rep(k, 3){
            if(A[j][k]==B) ok[j][k]=1;
        }
    }
 
    bool ans=false;
    if(ok[0][0]==1 && ok[0][1]==1 && ok[0][2]) ans=true;
    if(ok[1][0]==1 && ok[1][1]==1 && ok[1][2]) ans=true;
    if(ok[2][0]==1 && ok[2][1]==1 && ok[2][2]) ans=true;
    if(ok[0][0]==1 && ok[1][0]==1 && ok[2][0]) ans=true;
    if(ok[0][1]==1 && ok[1][1]==1 && ok[2][1]) ans=true;
    if(ok[0][2]==1 && ok[1][2]==1 && ok[2][2]) ans=true;
    if(ok[0][0]==1 && ok[1][1]==1 && ok[2][2]) ans=true;
    if(ok[2][0]==1 && ok[1][1]==1 && ok[0][2]) ans=true;
 
    if(ans) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3600
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#include<bits/stdc++.h>  
#define endl "\n"
using namespace std;
	typedef long long ll;
	const int maxn=1050;
	const int inf=0x3f3f3f3f;
	const int mod=1e9+7;
	int ans;
	char _map[maxn][maxn];
	int dp[maxn][maxn];
	ll n,m;
	int main(){
		IOS
		cin>>n>>m;
		for(int i=1;i<=n;i++)
			for(int j=1;j<=m;j++)
				cin>>_map[i][j];
		dp[1][1]=1;
		for(int i=1;i<=n;i++)
			for(int j=1;j<=m;j++){
				if(_map[i][j-1]!='#'){
					dp[i][j]+=dp[i][j-1];
					dp[i][j]%=mod;
				}
				if(_map[i-1][j]!='#'){
					dp[i][j]+=dp[i-1][j];
					dp[i][j]%=mod;
				}
			}
		ans=dp[n][m];
		cout<<ans<<endl;
	}

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

int main(){
	string s1,s2;
	cin>>s1>>s2;
	int ans = 0;
	for (int i = 0; i<s1.length(); i++){
		if (s1[i] != s2[i]){
			ans++;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3824
#include<bits/stdc++.h>
using namespace std;
map<string,int> mp;
int main(){
	char ch;
	int n,i;
	string s;
	cin>>n;
	cin>>s;
	ch=s[s.size()-1];
	mp[s]=1;
	for(i=2;i<=n;i++){
		cin>>s;
		if(mp.find(s)==mp.end()&&s[0]==ch){
			mp[s]=1;
			ch=s[s.size()-1];
		}
			else{
				cout<<"No"<<endl;return 0;
			} 
	}
	cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <cmath>
#include <utility> // pair make_pair
#include <algorithm>
#include <functional>
#include <iomanip>
#include <climits> // LLONG_MAX, LLONG_MIN, INT_MIN, INT_MAX
#include <assert.h>

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define ll long long
//#define int ll
#define INF INT_MAX/10

using namespace std;
using Pi = pair<int, int>;
using Graph = vector<vector<int> >;
using WeightGraph = vector<vector<Pi> >;

WeightGraph WG(300100);
int D[300100];

// Input: WeightedGraph, Number of nodes, Starting node
// O( (|V| + |E|) * log(|V|) )
int dijkstra(const WeightGraph& WG, int (&D)[300100],  const int& N, const int& S, const int& T) {
  // setup1 (priority queue with smallest second element on top)
  auto compare = [](const Pi& l, const Pi& r) { return l.second >  r.second; };
  priority_queue<Pi, vector<Pi>, decltype(compare)> PQ(compare);
  // setup2 (distance vector)
  // int D[N];
  // setup3 (vector that denotes done:2, doing:1, unseen:0)
  int C[3*N];

  // initialization1
  for (int i = 0; i < 3*N; i++) {
    D[i] = INF;
    C[i] = 0;
  }
  // initialization2
  D[3*S] = 0; // starting point
  PQ.push(make_pair(3*S, 0)); // (vertex S, distance 0)

  while (!PQ.empty()) {
    Pi nearest = PQ.top(); PQ.pop();
    int v = nearest.first;
    int d = nearest.second;
    C[v] = 2;
    if (D[v] < d) continue;

    for (auto adjacent: WG[v]) {
      int nv = adjacent.first;
      int nd = adjacent.second;
      
      if (C[nv] == 2) continue;
      if (D[nv] > D[v] + nd) {
        D[nv] = D[v] + nd;
        PQ.push(make_pair(nv, D[nv]));
        C[nv] = 1;
      }
    }
  }
  // for (int i = 0; i < N; i++) {
  //   cout << D[i] << endl; // Distance from Node S
  // }
  return D[3*T];
}


int main() {
  int N, M; cin >> N >> M;
  
  for (int i = 0; i < M; i++) {
    int a, b; cin >> a >> b;
    a--, b--;
    WG[3*a].push_back(Pi(3*b + 1, 1));
    WG[3*a + 1].push_back(Pi(3*b + 2, 1));
    WG[3*a + 2].push_back(Pi(3*b, 1));
  }

  int S, T;
  cin >> S >>  T;
  S--; T--;

  int ans = dijkstra(WG, D, N, S, T);
  if (ans == INF) {
    cout << -1 << endl;
  } else {
    cout << ans / 3 << endl;
  }
}


Measured memory_bytes: 19580
#include<stdio.h>

int main(){

  int n;
  int a;
  int employee[200001] = {0};

  scanf("%d", &n);
  for(int i=1;i<n;i++){
    scanf("%d", &a);
    employee[a]++;
  }
  for(int i=1;i<=n;i++){
    printf("%d\n", employee[i]);
  }
  return 0;
}

Measured memory_bytes: 2504
$<.map{|s| s.split.map(&:to_i)}.each{|an, l|
  break if an == 0 && l == 0
  (1..Float::INFINITY).inject(Array.new){|xs, i|
    xs << an
    an = (t=("%0#{l}d"%an).split(//).sort; t.reverse.join.to_i - t.join.to_i)
    j = xs.index(an)
    (puts "#{j} #{an} #{i-j}";break)unless j.nil?
    xs
  }
}

Measured memory_bytes: 6140
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

alias K = Tuple!(int, "d", bool, "is_t");

void main()
{
    auto nk = readln.split.to!(int[]);
    auto N = nk[0];
    auto H = nk[1];
    K[] ks;
    foreach (_; 0..N) {
        auto ab = readln.split.to!(int[]);
        ks ~= K(ab[0], false);
        ks ~= K(ab[1], true);
    }
    sort!"a.d > b.d"(ks);
    int r;
    while (H > 0) {
        auto k = ks[0];
        if (k.is_t) {
            ++r;
            H -= k.d;
            ks = ks[1..$];
        } else {
            r += (H + k.d - 1) / k.d;
            break;
        }
    }
    writeln(r);
}

Measured memory_bytes: 4732
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

void	solve()
{
	string s;
	cin >> s;

	int n = s.size();
	rep(i, n) {
		if ((i % 2 && s[i] == 'R') || (i % 2 == 0 && s[i] == 'L')) {
			cout << "No" << endl;
			return;
		}
	}
	cout << "Yes" << endl;
}

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

	solve();
}


Measured memory_bytes: 256
while True:
  N, M = map(int, input().split())
  if N==M==0:
    break
  Mi = [0] * N
  Ma = [0] * N
  for _ in range(M):
    L = list(map(int, input().split()))
    s, k = L[:2]
    if k==1:
      Mi[L[2]-1] += s
    for c in L[2:]:
      Ma[c-1] += s
  Mi_ = sorted(zip(Mi, range(N)))
  Ma_ = sorted(zip(Ma, range(N)))
  ans = Ma_[-1][0] - Mi_[0][0]
  #print(Ma, Mi)

  if Ma_[-1][1] == Mi_[0][1]:
    ans = max(Ma_[-1][0] - Mi_[1][0], Ma_[-2][0] - Mi_[0][0])
  print(ans + 1)



Measured memory_bytes: 9468
function Main(input) {
    const s = input.trim();
    if(s.includes("RRR")) {
        console.log(3);
    } else if(s.includes("RR")) {
        console.log(2);
    } else if(s.includes("R")) {
        console.log(1);
    } else {
        console.log(0);
    }

}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29544
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define mem(x,y)		(x*)malloc(sizeof(x)*(y))
#define PI 3.14159265358979

int int_sort(const void* a,const void* b)
{
	if(*(int*)a > *(int*)b)
	{
		return 1;
	}
	else if(*(int*)a == *(int*)b)
	{
		return 0;
	}
	return -1;
}

int main()
{
	int w,h,n;
	int i,j;
	scanf("%d %d",&w,&h);
	scanf("%d",&n);
	int** list = mem(int*,2);
	int** data = mem(int*,n);
	list[0] = mem(int,n);
	list[1] = mem(int,n);
	for(i = 0;i < n;i++)
	{
		data[i] = mem(int,2);
		scanf("%d %d",&data[i][0],&data[i][1]);
		list[0][i] = data[i][0];
		list[1][i] = data[i][1];
	}
	qsort(list[0],n,sizeof(int),int_sort);
	qsort(list[1],n,sizeof(int),int_sort);
	int a,b,c,d;
	a = list[0][(n-1)/2];
	b = list[1][(n-1)/2];
	c = list[0][n/2];
	d = list[1][n/2];
	long long int time = 0;
	long long int maxtime = 0;
	int maxp = 0;
	for(i = 0;i < n;i++)
	{
		int times[4];
		times[0] = abs(a-data[i][0])+abs(b-data[i][1]);
		times[1] = abs(a-data[i][0])+abs(d-data[i][1]);
		times[2] = abs(c-data[i][0])+abs(b-data[i][1]);
		times[3] = abs(c-data[i][0])+abs(d-data[i][1]);
		time += times[0];
		for(j = 0;j < 4;j++)
		{
			if(times[j] > maxtime)
			{
				maxtime = times[j];
				maxp = j;
			}
			else if(times[j] == maxtime)
			{
				if(maxp > j)
				{
					maxp = j;
				}
			}
		}
	}
	printf("%lld\n",time*2-maxtime);
	switch(maxp)
	{
		case 0:
			printf("%d %d\n",a,b);
			break;
		case 1:
			printf("%d %d\n",a,d);
			break;
		case 2:
			printf("%d %d\n",c,b);
			break;
		case 3:
			printf("%d %d\n",c,d);
			break;
	}
	return 0;
}

Measured memory_bytes: 0
// failed to generate code

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;

int main(){	
	ll N, K;
	cin >> N >> K;
	vector<ll> P(N);

	rep(i, N) {
		cin >> P[i];
	}
	ll res = 1;
	ll dc = 0;
	rep(i, K-1) {
		if (P[i] > P[i+1]) dc++;
	}
	set<ll> st;
	rep(i, K) {
		st.insert(P[i]);
	}
	bool dc0 = false;
	if (dc == 0) dc0 = true;
 	rep(i, N-K) {
		if (P[i] > P[i+1]) dc--;
		if (P[i+K-1] > P[i+K]) dc++;
		bool eq = false;
		st.erase(P[i]);
		if (dc > 0 && P[i] < *st.begin() && *st.rbegin() < P[i+K]) eq = true;
		// cout << i << ": " << P[i] << " " << *st.begin() << " " << *st.rbegin() << " " << P[i+K] << " " << dc << " " << eq << endl;
		st.insert(P[i+K]);
		if ((dc > 0 || !dc0) && !eq) {
			res++;
			if (dc == 0) dc0 = true;
		}
	}

	cout << res << endl;
}


Measured memory_bytes: 11136
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<int>;
const int maxn = 5050, mlg = 18, rt = 1<<10, mod = 1e9 + 7;
int n, k, a[maxn], dp[maxn][maxn], sp[maxn][maxn];
int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin >> n >> k;
	for(int i = 0; i < n; i++) cin >> a[i];
	dp[0][0] = 1;
	for(int i = 0; i < n; i++) {
		for(int s = 0; s+a[i] <= k; s++) {
			dp[i+1][s+a[i]] |= dp[i][s];
		}
		for(int s = 0; s <= k; s++)
			dp[i+1][s] |= dp[i][s];
	}
	sp[0][0] = 1;
	for(int i = 0; i < n; i++) {
		for(int s = 0; s+a[n-i-1] <= k; s++) {
			sp[i+1][s+a[n-i-1]] |= sp[i][s];
		}
		for(int s = 0; s <= k; s++)
			sp[i+1][s] |= sp[i][s];
	}
	for(int i = 0; i <= n; i++)
		for(int s = 1; s <= k; s++)
			sp[i][s] += sp[i][s-1];
	int cnt = 0;
	for(int i = 1; i <= n; i++) {
		int good = 0;
		for(int s = 0; s < k; s++) {
			if(!dp[i-1][s]) continue;
			int r = k - s - 1;
			int l = max(0, k - s - a[i-1]);
			if(l <= r) good |= (sp[n-i][r] - (l?sp[n-i][l-1]:0)) > 0;
		}
		cnt += !good;
	}
	cout << cnt;
}


Measured memory_bytes: 198912
// Template Headers {{{
#include <bits/stdc++.h>
using namespace std;

using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long;
using pll = pair<ll, ll>; using vpll = vector<pll>;
using vll = vector<long long>; using vvll = vector<vll>;
template <class T> using min_queue = priority_queue<T, vector<T>, greater<T>>;
template <class T> istream &operator>>(istream &, vector<T> &);
template <class T> ostream &operator<<(ostream &, const vector<T> &);
template <class T, class U> istream &operator>>(istream &, pair<T, U> &);
template <class T, class U> ostream &operator<<(ostream &, const pair<T, U> &);
template <class T> struct Inf { static constexpr T inf() { return std::numeric_limits<T>::has_infinity ? std::numeric_limits<T>::infinity() : std::numeric_limits<T>::max(); } };
template <> struct Inf<int> { static constexpr int inf() { return 0x3f3f3f3f; } };
template <> struct Inf<long long> { static constexpr long long inf() { return 0x3f3f3f3f3f3f3f3fLL; } };
constexpr int INF = Inf<int>::inf(); constexpr ll BINF = Inf<ll>::inf();
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// }}}
// Preprocessing & "Global" variables {{{
struct Solver {
	Solver() {}
	int solve();
};
// }}}

int Solver::solve() {
	int n; cin >> n;
	vi a(n); cin >> a;
	ll ans = 0;
	for (int i = 1; i < n; i++) {
		int yo = max(a[i], a[i - 1]);
		ans += yo - a[i];
		a[i] = yo;
	}
	cout << ans << endl;
	return 0;
}

// Template Main {{{
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	Solver solver;
	#ifdef JUDGE_MULTI_CASE
		int t; cin >> t; for (int i = 1; i <= t; i++)
	#endif
	solver.solve();
	// cout << "Case #" << i << ": ", solver.solve();
	return 0;
}

template <class T> istream &operator>>(istream &is, vector<T> &v) {
	for (auto it=v.begin();it!=v.end();++it) is >> *it;
	return is;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
	for (auto it=v.begin();it!=v.end();) os << *it, os << " \n"[++it==v.end()];
	return os;
}

template <class T, class U> istream &operator>>(istream &is, pair<T, U> &p) {
	return is >> p.first >> p.second;
}

template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p) {
	return os << p.first << ' ' << p.second;
}
// }}}

// vim: fdm=marker


Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
//NOT TO SUBMIT IN WRONG PLACE
//ABS, task 09, 2020/04/11
//ms, tle
/*
*/

int main(void){
  int N;
  string S;
  int r=0;
  int64_t g=0;
  int b=0;
  int64_t ans;

  cin >>N;
  cin >>S;

  for(int i=0;i<N;i++){
    if(S.at(i)=='R') r++;
    if(S.at(i)=='G') g++;
    if(S.at(i)=='B') b++;
  }

  ans = r*g*b;
  //cout <<"r:" <<r <<" g:"<<g <<" b:" <<b <<endl;


  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      if(S.at(i) != S.at(j) && 2*j-i<N){
        if(S.at(i) != S.at(2*j-i)
         &&S.at(j) != S.at(2*j-i)) ans--;
      }
    }
  }

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

/*
rgbrgb
8
,,,,,,
,,
*/


Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[][] board = new char[n + 1][];
		for(int i = 0; i < n + 1; i++) {
			board[i] = sc.next().toCharArray();
		}
		int sum = 0; //print
		for(int i = 1; i <= n; i++) {//?????????????????£????????????
			out: for(int j = 0; j < board[i].length; j++) {//1??????????????¢?´¢
				if(board[i][j] == board[0][0]) {
					for(int k = j + 1; k < board[i].length; k++) {//2??????????????¢?´¢
						if(board[i][k] == board[0][1]) {
							int interval = k - j;//1???????????¨2??????????????????
							int cnt = 2;//?????????????????¢?´¢???????????????
							for(int m = k + interval; m < board[i].length; m = m + interval) {//3???????????\????????¢?´¢
								if(board[i][m] == board[0][cnt]) {
									cnt = cnt + 1;
									if(cnt == board[0].length) {
										sum = sum + 1;
										break out;
									}
								} else {
									break;
								}
							}
						}
					}
				}
			}
		}
		System.out.println(sum);
	}

}

Measured memory_bytes: 27660
N, M = map(int, input().split())
A = [list(input()) for _ in range(N)]
B = [list(input()) for _ in range(M)]
for i in range(N-M+1):
    for j in range(N-M+1):
        flg = True
        for k in range(M):
            for l in range(M):
                if A[i+k][j+l]!=B[k][l]:
                    flg = False    
        if flg == True:
            print('Yes')
            exit()             
print('No')

Measured memory_bytes: 3064
import math

A, B, H, M = map(int, input().split())

a_angle = 30 * (H + M / 60)
b_angle = 6 * M

if a_angle == 0:
    a_angle = 360

if b_angle == 0:
    b_angle = 360

if abs(a_angle - b_angle) < abs(b_angle - a_angle):
    angle = abs(a_angle - b_angle)
else:
    angle = abs(b_angle - a_angle)

# print(math.cos(math.radians(angle)))

X = math.sqrt(A**2 + B**2 - (2 * A * B * math.cos(math.radians(angle))))

print(X)

Measured memory_bytes: 9520
local ior = io.input()
local r, g, b, n = ior:read("*n", "*n", "*n", "*n")
local cnt = 0
for i = 0, n do
  for j = 0, n - i do
    local k = n - i - j
    if i % r == 0 and j % g == 0 and k % b == 0 then cnt = cnt + 1 end
  end
end
print(cnt)


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

int main() {
  int n,k;
  cin >> n >> k;

  int ans = 0;

  rep(i,n){
    int h;
    cin >> h;
    if (h >= k) ans++;
  }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define si(a) scanf("%d",&a)
#define sll(a) scanf("%lld",&a)
#define sl(a) scanf("%ld",&a)
#define pll(a) printf("%lld\n",a) 
#define sc(a) scanf("%c",&a)a
#define pc(a) printf("%c",a)
#define ll long long
#define mod 1000000007
#define w while
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define INF INT_MAX
#define fr(i,a,b) for(int i=a;i<=b;i++)
#define vi vector<int>
#define vl vector<ll>
#define pi pair<int,int>
#define pl pair<ll,ll>
long double PI=acos(-1);
//////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
int main()
{
	int n;
	cin>>n;
	ll a[n+1];
	ll tot=0;
	fr(i,1,n)
	{
		cin>>a[i];
		tot^=a[i];
	}
	fr(i,1,n)
	{
		cout<<(tot^a[i])<<" ";
	}
    return 0;
}





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

int main() {
  int N,X,Y,Z,A,B,C,ans,b,max,min;
  cin >>N;
  int a[N];
  max=-100001;
  min=1000001;
  for(int i=0;i<N;i++){
  cin>>a[i];
  if(a[i]>max){
  max=a[i];
    C=i;
  }
      if(a[i]<min){
  min=a[i];
    A=i;
  }
  }
  if(abs(max)>abs(min)){
    cout<<2*N-1<<endl;
    for(int i=0;i<N;i++){
      cout<<C+1<<" "<<i+1<<endl;
    }
    if(a[C]<=0){
      for(int i=N-1;i>0;i--){
        cout<<i+1<<" "<<i<<endl;
      }
      return 0;
    }
    else{
            for(int i=0;i<N-1;i++){
        cout<<i+1<<" "<<i+2<<endl;
      }
      return 0;
    }
  }
  else {
    cout<<2*N-1<<endl;
    for(int i=0;i<N;i++){
      cout<<A+1<<" "<<i+1<<endl;
    }
        if(a[A]<=0){
      for(int i=N-1;i>0;i--){
        cout<<i+1<<" "<<i<<endl;
      }
      return 0;
    }
    else{
            for(int i=0;i<N-1;i++){
        cout<<i+1<<" "<<i+2<<endl;
      }
      return 0;
    }
  }
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.*;
import java.util.*;

public class Main {

	public static void main(String[] args) throws IOException {
		FastReader in = new FastReader(System.in);
		PrintWriter out = new PrintWriter(System.out);
		char[] c = in.next().toCharArray();
		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < c.length - 2; i++) {
			int x = Integer.parseInt(c[i] + "" + c[i + 1] + "" + c[i + 2]);
			ans = Math.min(ans, Math.abs(x-753));
		}
		out.println(ans);

		out.flush();
		out.close();

	}

	static class FastReader {
		StringTokenizer st;
		BufferedReader br;

		public FastReader(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public FastReader(FileReader fileReader) {
			br = new BufferedReader(fileReader);
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

}

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

int main()
{
	int N;
	cin >> N;
	for (int i = 1; i <= 50000; ++i)
	{
		//cout << int(i * 1.08) << " ";
		if (int(i * 1.08) == N)
		{
			cout << i << endl;
			return 0;
		}
	}
	cout << ":(" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int h, w;
		while(true){
			h = sc.nextInt();
			w = sc.nextInt();
			if(h==0 && w==0)break;
			if(h<=300 && w<=300){
				for(int i=0; i<h; i++){
					for(int j=0; j<w; j++){
						System.out.print("#");
					}
					System.out.println();
				}
				System.out.println();
			}
		}
	}
}

Measured memory_bytes: 26864
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define read(UIET) for(int i = 0; i < n; ++i) cin >> UIET[i]
#define out(UIET) for(int i = 0; i < n; ++i) cout << UIET[i]
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define debug(n1) cout << n1 << endl
#define len(a) ((int) (a).size())
#define endl "\n"
#define mod 1000000007
const int INF=(1LL<<60)-1;
const int MAXN = 1000001;
string extractStringAtKey(string str, int key){
    char *s = strtok((char *)str.c_str(), " ");
    while(key > 1){
        s = strtok(NULL, " ");
        key--;
    }
    return (string)s;
}
int32_t main(){
    SPEED;
    string s;
    cin >> s;
    if((s[0] - '0') + (s[1] - '0') + (s[2] - '0') + (s[3] - '0') == 7){
        cout << s[0] << "+" << s[1] << "+" << s[2] << "+" << s[3] << "=7";
        return 0;
    }
    if((s[0] - '0') + (s[1] - '0') + (s[2] - '0') - (s[3] - '0') == 7){
        cout << s[0] << "+" << s[1] << "+" << s[2] << "-" << s[3] << "=7";
        return 0;
    }
    if((s[0] - '0') + (s[1] - '0') - (s[2] - '0') + (s[3] - '0') == 7){
        cout << s[0] << "+" << s[1] << "-" << s[2] << "+" << s[3] << "=7";
        return 0;
    }
    if((s[0] - '0') - (s[1] - '0') + (s[2] - '0') + (s[3] - '0') == 7){
        cout << s[0] << "-" << s[1] << "+" << s[2] << "+" << s[3] << "=7";
        return 0;
    }
    if((s[0] - '0') - (s[1] - '0') - (s[2] - '0') - (s[3] - '0') == 7){
        cout << s[0] << "-" << s[1] << "-" << s[2] << "-" << s[3] << "=7";
        return 0;
    }
    if((s[0] - '0') - (s[1] - '0') - (s[2] - '0') + (s[3] - '0') == 7){
        cout << s[0] << "-" << s[1] << "-" << s[2] << "+" << s[3] << "=7";
        return 0;
    }
    if((s[0] - '0') - (s[1] - '0') + (s[2] - '0') - (s[3] - '0') == 7){
        cout << s[0] << "-" << s[1] << "+" << s[2] << "-" << s[3] << "=7";
        return 0;
    }
    if((s[0] - '0') + (s[1] - '0') - (s[2] - '0') - (s[3] - '0') == 7){
        cout << s[0] << "+" << s[1] << "-" << s[2] << "-" << s[3] << "=7";
        return 0;
    }
}
// + + +, + + -, + - +, - + +
// - - -, - - +, - + -, + - -

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

n = int(input())
a_li = list(map(int, (input().split())))

product = 1

if 0 in a_li:
    product = 0
else:
    for i in a_li:
        product *= i
        if product > 10**18:
            print(-1)
            exit()

print(product)

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


int main() {
    ll a; cin>>a;
    double b; cin>>b;
    ll ib=b*100+0.1;
    a*=ib;
    a/=100;
    cout<<a<<endl;
}

Measured memory_bytes: 3708
#!python
# -*- coding: utf-8 -*-


S = input()
T_s = ["dream", "dreamer", "erase", "eraser"]

while len(S):
    for T in T_s:
        if T == S[-len(T):]:
            S = S[:-len(T)]
            break
    else:
        print("NO")
        break
else:
    print("YES")


Measured memory_bytes: 3264
n = int(input())
ls = list(map(int,input().split()))
ans = 0

if n > 2:
    ls.sort()
    for i in range(n - 2):
        for j in range(i + 1,n - 1):
            for k in range(j + 1,n):
                if ls[i] < ls[j] and ls[j] < ls[k] and ls[k] < ls[i] + ls[j]:
                    ans += 1

print(ans)


Measured memory_bytes: 9184