akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define rep(i, n) for (i = 0; i < n; i++)
#define rrep(i, n) for (i = n; i >= 0; i--)
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b)

int n, m, g[9][9], v[9] = { 0, 1 }, ans;

void dfs(int i, int s) {
    int k;
    for (k = 1; k <= n; k++) {
        if (g[i][k] == 1 && v[k] == 0) {
            v[k] = 1;
            dfs(k, s + k);
        }
    }
    v[i] = 0;
    if (s == n * (n + 1) / 2) ans++;
    return;
}

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

    int a, b, i;
    rep(i, m) {
        scanf("%d %d", &a, &b);
        g[a][b] = g[b][a] = 1;
    }

    dfs(1, 1);
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std ;
typedef long long ll ;
int main(){
int n;

scanf("%d",&n);

char a[n];
// int res[4]
int flag = 0;

for (int i = 0; i<n; i++){
    scanf("%s",&a[i]);
    if (a[i] == 'Y') flag = 1;
    // printf("%s",&a[i]);
}

if (flag == 1) printf("Four");
else printf("Three");

}

Measured memory_bytes: 256
#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++)

using namespace std;
const int INF = 1 << 30;
const long long LINF = 1LL << 60;
const long long MOD = 1000000000 + 7;
const double PI = acos(-1);

int main() {
	int A, B; cin >> A >> B;
	cout << A * B;
}



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

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,a,n) for(int i=a;i<n;i++)

typedef long long ll;

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

int dp[3010][3010];

void Main()
{
	string s, t; cin >> s >> t;
	int S = s.size();
	int T = t.size();
	memset(dp, 0, sizeof(dp));
	rep(i,S + 1) {
		rep(j,T + 1) {
			if (s[i] == t[j]) chmax(dp[i + 1][j + 1], dp[i][j] + 1);
			chmax(dp[i + 1][j + 1], dp[i + 1][j]);
			chmax(dp[i + 1][j + 1], dp[i][j + 1]);
		}
	}
	string res = "";
	int i = S; int j = T;
	while (i > 0 && j > 0) {
		if (dp[i][j] == dp[i - 1][j]) {
			--i;
		} else if (dp[i][j] == dp[i][j - 1]) {
			--j;
		} else {
			res = s[i - 1] + res;
			--i; --j;
		}
	}
	cout << res << endl;
}

int main()
{
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	Main();
}


Measured memory_bytes: 35712
import java.util.Scanner;
class Main
{
	public static void main(String[] args)throws Exception
	{
		Scanner scan=new Scanner(System.in);
		
		int W=scan.nextInt();
		int H=scan.nextInt();
		int x=scan.nextInt();
		int y=scan.nextInt();
		int r=scan.nextInt();
		

		if(W<x||W==x||H<y||H==y||x<1||y<1||W<r||H<y||W<(r*2)||H<(r*2))
		{
			System.out.println("No");
		}
		else
		{
			System.out.println("Yes");
		}
	}
}

Measured memory_bytes: 26364
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(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 index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  vector<pair<long long, P> > vs;
  rep(i, N) {
    int a, b;
    cin >> a >> b;
    vs.pb(make_pair(a+b, P(a,b)));
  }
  long long s = 0;
  sort(all(vs));
  reverse(all(vs));
  rep(i, N) {
    if (i%2==0) s += vs[i]._2._1;
    else s -= vs[i]._2._2;
  }
  cout << s << "\n";
  return 0;
}


Measured memory_bytes: 2420
import sys
input = sys.stdin.readline
S = input()
a = int(S[:2])
b = int(S[2:])
if (0<=a<=99 and 1<=b<=12) or (1<=a<=12 and 0<=b<=99):
    if 1<=a<=12 and 1<=b<=12:
        print ("AMBIGUOUS")
    elif 0<=a<=99 and 1<=b<=12:
        print("YYMM")
    else:
        print("MMYY")
else:
    print("NA")

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

long long Fac(int i)
{
  long long x=1;
  int j;
  for(j=1;j<i+1;j++)
  {
    x=x*j;
  }
  return x;
}
long dictionary_order(int *p,int l)
{
  int i,j,t;
  long long ans=0;
  long long x[l]={};
  
  for(i=0;i<l;i++)
  {
    t=p[i]-1;
    if(t>0)
    {for(j=0;j<i;j++)
    {
      if(p[i]>p[j])
      {
        t=t-1;
      }
    }
    x[i]=t*Fac(l-i-1);
    }
  }
  for (i=0;i<l;i++)
  {
    ans=ans+x[i];
  } 
  return ans+1;
}

int main()
{
  int l,i;
  cin >>l;
  
  int p[l],q[l]; 
  long long a,b;
  
  
  for(i=0;i<l;i++)
  {
   cin >>p[i];
   
  }
  for(i=0;i<l;i++)
  {
  cin >>q[i];
  }
  
  a=dictionary_order(p,l);
  b=dictionary_order(q,l);
  
  
  if(a>b)
  {
    a=a-b;
  }else
  {
    a=b-a;
  }

  
  cout << a <<endl;
  
  
  
  
  
  return 0;
}


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

string N;

int main(){
	cin >> N;
	int acc = 0;
	for(int i = 0; i < N.size(); i++){
		int c = N[i] - '0';
		acc += c;
		acc %= 9;
	}
	if(acc == 0){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 3748
#include <iostream>
#include <cmath>

typedef unsigned long long L_LONG;

int main(){
  const L_LONG mod = 7 + std::pow(10,9);
  
  L_LONG N = 0;
  L_LONG k = 0;
  
  std::cin >> N >> k;
  
  L_LONG sum = 0;
  for(L_LONG cnt = k ; cnt <= N+1 ; cnt++){
    L_LONG big = (cnt*(2*N-cnt+1))/2;
    L_LONG small = (cnt*(cnt-1))/2;
    sum = ( sum + ( big - small + 1 ) ) % mod;
  }
  
  std::cout << sum << std::endl;
  
  return 0;
}

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

int abs(int v) {
  return (v < 0)? -v : v;
}

const int mod = 1e9 + 7;
long long int fact[100000];
void init(int n) {
  fact[0] = 1;
  for (int i = 1; i <= n; ++i) {
    fact[i] = (fact[i-1] * i) % mod;
  }
}

int main(int argc, char *argv[])
{
  int n, m;
  cin >> n >> m;
  if (abs(n-m) > 1) {
    cout << 0 << endl;
    return 0;
  }
  init(n < m ? m : n);

  if (n == m) {
    long long int a = (((fact[n] * fact[m]) % mod) * 2) % mod;
    cout << a << endl;
    return 0;
  }

  long long int a = (fact[n] * fact[m]) % mod;
  cout << a << endl;
  return 0;
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		String str = input.readLine();
		int n = Integer.parseInt(str);
		str = input.readLine();
		String temp = str;
		while(temp.contains("()")){
			temp = temp.replace("()", "");
		}
		int r = temp.length() - temp.replace("(", "").length();
		int l = temp.length() - temp.replace(")", "").length();

		for(int i=0; i<r; i++){
			str = str + ")";
		}
		for(int i=0; i<l; i++){
			str = "(" + str;
		}


		System.out.println(str);
	}

}

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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, K;
  cin >> N >> K;
  vector<vector<int>> TD(N);
  for (int i = 0; i < N; i++) {
    int t, d;
    cin >> t >> d;
    TD[--t].push_back(d);
  }

  vector<int> y0, y1;
  for (int i = 0; i < N; i++) {
    if (TD[i].size() == 0)
      continue;
    sort(TD[i].begin(), TD[i].end());
    y1.push_back(TD[i].back());
    TD[i].pop_back();
    y0.insert(y0.end(), TD[i].begin(), TD[i].end());
  }
  sort(y0.begin(), y0.end(), greater<int>());
  sort(y1.begin(), y1.end(), greater<int>());
  int Y  = max(0, (int)(K - y0.size()));
  ll res = 0, X = 0;
  for (int i = 0; i < Y; i++)
    X += y1[i];
  for (int i = 0; i < K - Y; i++)
    X += y0[i];
  while (true) {
    res = max(res, X + 1LL * Y * Y);
    if (Y >= K || Y >= y1.size())
      break;
    X += y1[Y];
    X -= y0[K - Y - 1];
    Y++;
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 6396
from collections import deque
H, W = list(map(int, input().split()))

g = []

for _ in range(H):
    g.append(list(input()))

dist = [[-1 for _ in range(W)] for _ in range(H)]
queue = deque()

for i in range(H):
    for j in range(W):
        if g[i][j] == "#":
            dist[i][j] = 0
            queue.append((j, i))

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]

while len(queue) > 0:
    now_x, now_y = queue.popleft()

    for dx_, dy_ in zip(dx, dy):
        adj_x = now_x + dx_
        adj_y = now_y + dy_

        if (not 0 <= adj_x < W) or (not 0 <= adj_y < H):
            continue

        if g[adj_y][adj_x] == "#" :
            continue

        if g[adj_y][adj_x] == ".":
            g[adj_y][adj_x] = "#"
            queue.append((adj_x, adj_y))
            dist[adj_y][adj_x] = dist[now_y][now_x] + 1

ans = 0
for i in range(H):
    for j in range(W):
        ans = max(dist[i][j], ans)

print(ans)


Measured memory_bytes: 155996
#include<cstdio>
#include<cmath>
int a, b;
int main() {
	scanf("%d %d",&a,&b);
	if( 9 >= b && b >= 0 ) {
		int c = b + 10 * a;
		if( int(sqrt(c)) * int(sqrt(c)) == c ) 
		{
			printf("Yes");
			return 0;
		}
		else {
			printf("No");
			return 0;
		}
	}
	if( 99 >= b && b >= 10 ) {
		int c = b + 100 * a;
		if( int(sqrt(c)) * int(sqrt(c)) == c ) 
		{
			printf("Yes");
			return 0;
		}
		else {
			printf("No");
			return 0;
		}
	}
	if( 999 >= b && b >= 100 ) {
		int c = b + 1000 * a;
		if( int(sqrt(c)) * int(sqrt(c)) == c ) 
		{
			printf("Yes");
			return 0;
		}
		else {
			printf("No");
			return 0;
		}
	}
}

Measured memory_bytes: 128
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
int main() {
	int prev[1001] = {0};
	int next[1001] = {0};
	string in;
	int num,d;
	while(getline(cin,in),in.size() > 0) {
		sscanf(in.c_str(),"%d,%d",&num,&d);
		prev[num]++;
	}
	while(~scanf("%d,%d",&num,&d)) {
		if(prev[num] > 0)
			next[num]++;
	}
	for(int i = 0; i < 1001; i++) {
		if(next[i] > 0) printf("%d %d\n",i,prev[i]+next[i]);
	}

	return 0;
}

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

vector<int>v[30], ans;
bool flag[30];

int main() {
	int m, n;scanf("%d%d", &m, &n);
	rep(i, n) {
		int x, y; scanf("%d%d", &x, &y);
		x--; y--;
		v[y].push_back(x);
	}
	while (1) {
		if (ans.size() == m)break;
		rep(i, m) {
			bool ok = true;
			for (int j : v[i])if(!flag[j])ok = false;
			if (ok && !flag[i]) {
				flag[i] = true;
				ans.push_back(i + 1);
			}
		}
	}
	for (int i : ans) {
		cout << i << endl;
	}
}

Measured memory_bytes: 3216
#include <iostream>
using namespace std;
int main(void){  
  int X, Y, f, f2;
  bool flag = true;
  cin >> X >> Y;
  f = X * 2;
  f2 = X * 4;
  for(int i = f; i<=f2; i=i+2)
  {
    if(i == Y)
    {
      cout << "Yes" << endl;
      flag = false;
    }
  }
  if(flag == true)
  {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3128
#include<iostream>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<queue>

using namespace std;

int a,b,c,d;
string s;

int main(){
  cin>>a;
  int tmp = a;
  int total = 0;
  while(tmp !=0){
    total += tmp%10;
    tmp /= 10;
  }
  if(a%total == 0){
    cout<<"Yes"<<endl;
  }else {
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define rrep(i, a, b) for (int i = (a); i < (b); ++i)
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n; cin>>n;
    vl as(n); cin>>as;

    sort(rrng(as));
    map<ll, ll> mp;
    rep(i, n) mp[as[i]]++;
    ll b = 1;
    while (b < 1e9) b *= 2;
    ll ans = 0;
    rep(i, n) {
        if (mp[as[i]] == 0) continue;
        mp[as[i]]--;

        while (b / 2 > as[i]) {
            b /= 2;
        }
        ll r = b - as[i];
        if (mp[r] > 0) {
            ans++;
            mp[r]--;
        }
    }
    cout<<ans<<endl;
}

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

#define ll long long

#define ff first
#define ss second
bool comp(ll a,ll b){
    return a > b;
}

bool check(vector<ll> &a,ll k){
    ll n = a.size();
    
    for(ll i=0;i<n-1;i+=2){
        ll x = max(a[i],a[i+1]);
        k-=x;
        if(k<0) return false;
    }
    
    if(n&1){
        k-= a[n-1];
    }
    if(k<0) return false;
    return true;
    
}

void solve()
{
    string s;cin>>s;
    set<char> st;
    for(ll i=0;i<s.size();i++){
        st.insert(s[i]);
    }
    if(st.size()>1){
        cout<<"Yes\n";
    }
    else
        cout<<"No";
}

int main(){
    
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // ll t;cin>>t;while(t--)
        solve();
    
}

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

int main(){
    int x, a, b;
    cin >> x >> a >> b;
    auto c = b - a;
    if (b - a <= 0){
        cout << "delicious" << endl;
    } else if (b - a <= x)
        cout << "safe" << endl;
    else
        cout << "dangerous" << endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define dump(a) cout << a << endl; 

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; }

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文

int main() {
	double t, x;
	cin >> t >> x;
	cout << setprecision(15) << t / x << endl;
}


Measured memory_bytes: 256
def main():
    from collections import defaultdict
    import sys
    input=sys.stdin.readline
    n=int(input())
    a=list(map(int,input().split()))
    ap=defaultdict(int)
    am=defaultdict(int)
    for i in range(n):
        ap[a[i]+i]+=1
        am[i-a[i]]+=1
    ans=0
    for k,v in ap.items():
        if k in am:
            ans+=v*am[k]
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 58092
import bisect
n=int(input())
a,b,c=map(list,[sorted(list(map(int, input().split()))) for i in range(3)])
ans=0
for i in range(n):
    ans+=bisect.bisect_left(a,b[i])*(n-bisect.bisect_right(c,b[i]))
print(ans)

Measured memory_bytes: 28932
p=print
b=0
for e in iter(input,'0 0'):
 if b:p()
 b=u=1
 s,t=map(int,e.split())
 for y in range(s,t+1):
  if((y%4==0)*(y%100!=0)or y%400==0):p(y);u=0
 if u:p('NA')


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

ll calc(int a, int b){
	int x = max(a,b), y = min(a,b);
	int c = x%y;
	if(!c) return y;
	return calc(y, c);
}

int main() {
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll g = (c*d)/calc(c, d);
	if(c == d) g = c;
	ll h = b / g - (a-1) / g;
	ll e = b / c - (a-1) / c;
	ll f = b / d - (a-1) / d;
	ll dif = (b - a);
	ll res = (dif + 1) - (e+f-h);
	cout << res << '\n';
 	return 0;
}


Measured memory_bytes: 256
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    s = collections.Counter(str(input().rstrip('\n'))).most_common()
    t = collections.Counter(str(input().rstrip('\n'))).most_common()
    if len(s) != len(t):
        print("No")
    else:
        for i in range(len(s)):
            if s[i][1] != t[i][1]:
                print("No")
                exit()
        print("Yes")


if __name__ == '__main__':
    slove()


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

typedef long long ll;

int trans(char c){
    if('0'<=c && '9'>=c) return (c-0x30);
	if('A'<=c && 'F'>=c) return (c+0x0A-0x41);
	if('a'<=c && 'f'>=c) return (c+0x0A-0x61);
	return 0;
}

int main(){
    char a,b;
    cin>>a>>b;
    if(trans(a)<trans(b)){
        cout<<"<"<<endl;
    }
    else if(trans(a)>trans(b)){
        cout<<">"<<endl;
    }else{
        cout<<"="<<endl;
    }
    return 0;
}


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

int main(){
    int N;
    cin >> N;
    int ans = 0, now = 0;
    lint back;
    cin >> back;
    for(int i = 0; i < N - 1; i++){
        lint H;
        cin >> H;
        if(back >= H){
            now++;
        }else{
            ans = max(ans, now);
            now = 0;
        }
        back = H;
    }
    ans = max(ans, now);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

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 main() {
  int N;
  int M;
  cin >> N >> M;
  if (N == M)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

int main() {
    fastio
    
	ll n,i,j,x,t,k,m,y;
	cin>>n;
	
	ll a[n],b[n],c[n],dp[n][3];
	
	for(j=0;j<n;j++)
	cin>>a[j]>>b[j]>>c[j];
	
	dp[0][0]=a[0];
	dp[0][1]=b[0];
	dp[0][2]=c[0];
	
	for(j=1;j<n;j++){
	    dp[j][0]=max(dp[j-1][1],dp[j-1][2])+a[j];
	    dp[j][1]=max(dp[j-1][0],dp[j-1][2])+b[j];
	    dp[j][2]=max(dp[j-1][0],dp[j-1][1])+c[j];
	}
	
	cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
	
	return 0;
}



Measured memory_bytes: 8320
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;

#define ll long long
#define pb push_back

int main() {

	int N,K;
	cin>>N>>K;
	if(N%K==0)cout<<0<<endl;
	else cout<<1<<endl;

	return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()
r, g, b = 0, 0, 0
for c in S:
    if c == "R":
        r += 1
    elif c == "G":
        g += 1
    else:
        b += 1
ans = r * g * b
sub = 0
for i in range(N):
    for j in range(i+1, N):
        if S[i] == S[j]:
            continue
        k = 2 * j - i
        if k >= N or S[k] == S[i] or S[k] == S[j]:
            continue
        sub += 1
print(ans - sub)

Measured memory_bytes: 9168
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <assert.h>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main(){
  string s;
  cin>>s;
  ll a = 0;
  rep(i,0,s.sz){
    a += s[i]-'0';
  }
  if(a%9==0){
      cout << "Yes" << endl;
  }
  else{
      cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
#ifdef IS_MY_ENV
#include <tourist>
#endif
using namespace std;

#define int long long

int n, W;
int w[110], v[110];

int dp[110][100100];

int dfs ( int pos, int left ) {
    if ( pos == n ) return 0;
    if ( ~dp[pos][left] ) return dp[pos][left];
    if ( left - w[pos] < 0 ) return dp[pos][left] = dfs ( pos+1, left );
    return dp[pos][left] = max(dfs ( pos+1, left ), dfs(pos+1, left-w[pos])+v[pos]);
}

signed main() {

    memset(dp, -1, sizeof(dp));

    cin >> n >> W;
    for ( int i = 0; i < n; i++ ) {
        cin >> w[i] >> v[i];
    }

    cout << dfs(0, W) << endl;

    return 0;
}

Measured memory_bytes: 86272
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

enum MOD = (10 ^^ 9) + 7;

void main()
{
    long N = lread();
    long sum;
    long mins = long.max;
    foreach (_; 0 .. N)
    {
        long s = lread();
        if (s % 10 != 0)
            mins = mins.min(s);
        sum += s;
    }
    if (sum % 10 != 0)
    {
        writeln(sum);
        return;
    }
    if (mins != long.max)
    {
        writeln(sum - mins);
        return;
    }
    writeln(0);
}


Measured memory_bytes: 256
import Control.Monad
import Control.Applicative
readDigits = map read <$> words <$> getLine :: IO [Int]
main =
    loop
    where
    loop = do
        [h,w] <- readDigits
        unless (h == 0 && w == 0) $ do
            putStrLn . unlines . replicate h $ replicate w '#'
            loop

Measured memory_bytes: 4104
#include <iostream>
using namespace std;
int pow2(int n) {
    int result = 1;
    for (int i=0; i<n; i++) {
        result *= 2;
    }
    return result;
}
int main() {
    int n;
    cin >> n;
    int num[30];
    int arrpow2[30];
    for (int i=0; i<30; i++) {
        num[i] = 0;
        arrpow2[i] = pow2(i);
    }
    int a[n];
    for (int i=0; i<n; i++) {
        cin >> a[i];
        int j=0;
        while (a[i]/arrpow2[j] > 0) {
            num[j] += (a[i]/arrpow2[j]%2);
            j++;
        }
    }
    for (int i=0; i<n; i++) {
        int result;
        result = a[i];
        for (int j=0; j<30; j++) {
            if (num[j]%2 == 1) {
                if ((a[i]/arrpow2[j])%2 == 1) {
                    result -= arrpow2[j];
                } else {
                    result += arrpow2[j];
                }
            }
        }
        cout << result << " ";
    }
    cout << endl;
}

Measured memory_bytes: 4356
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define BR cout<<endl;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;
const ll mod=1000000007;

ll powmod(ll x,ll y){
    ll res=1;
    for(ll i=0;i<y;i++){
        res=res*x%mod;
    }
    return res;
}

double expect(int x){
    double kitai,tem=0;
    for(int i=1;i<=x;i++){
        tem += i;
    }
    kitai = tem/x;
    cout << kitai << endl;
    return kitai;
    
}

int main(){
    int n;cin >> n;
    int k;cin >> k;
    double p[n];rep(i,n) cin >> p[i];

    double q[n];
    rep(i,n)q[i] = (p[i]+1)/2;

    double c[n];
    rep(i,n)c[i] = 0;
    rep(i,n)c[i + 1] = c[i] + q[i];

    double ans =0;
    rep(i, n){
        if(i + k >= n + 1)break;
        chmax(ans, c[i + k] - c[i]);
    }

    FOUT(12, ans)BR;


    return 0;
}



Measured memory_bytes: 8392
fun main(arg: Array<String>) {
    val (H, W, N) = listOfInt()
    val M = java.util.HashMap<Pair<Int, Int>, Int>()
    repeat(N) {
        val (a, b) = listOfInt(-1)
        for (h in -1 .. 1) {
            for (w in -1 .. 1) {
                val key = a + h to b + w
                if ((key.first in 1 until H - 1) && (key.second in 1 until W - 1))
                    M.set(a + h to b + w, M.getOrElse(a + h to b + w, { 0 }) + 1)
            }
        }
    }
    val ans = LongArray(10)
    for ((key, cnt) in M) ans[cnt] = ans[cnt] + 1
    ans[0] = (1L * (H - 2) * (W - 2)) - ans.sum()
    ans.forEach { println(it) }
}
fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfLong() = listOfString().map(String::toLong)
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }




Measured memory_bytes: 203128
#include<bits/stdc++.h>
using namespace std;
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
#define sz(a) ll(a.size())
ll a[200005];
void solve(){
	ll n;
	cin>>n;
	for(ll i=0;i<n;i++)
		cin>>a[i];
	ll res=0;
	for(ll i=1;i<n;i++){
		res+=max(ll(0),a[i-1]-a[i]);
		a[i]=max(a[i-1],a[i]);
	}
	cout<<res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w", stdout);
    #endif
    clock_t z=clock();
    ll qc=1;
    //cin>>qc;
    for(ll i=1;i<=qc;i++){
        solve();
    }
    debug("Total Time:%.4Lf\n",(ld)(clock()-z)/CLOCKS_PER_SEC);
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

int main(){
    ll n;cin >>n;
    if(n%10==3){
        puts("bon");
    }
    else if(n%10==0){
        puts("pon");
    }
    else if(n%10==1){
        puts("pon");
    }
    else if(n%10==6){
        puts("pon");
    }
    else if(n%10==8){
        puts("pon");
    }
    else {
        puts("hon");
    }
    return 0;
}



Measured memory_bytes: 3652
#include<stdio.h> 
#include<iostream> 
#include<string.h>
#include<cstring>
#include<string>
#include<math.h>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<queue>
#include<set>
#define cuttime ios::sync_with_stdio(false)
#define swap(x, y) x ^= y, y ^= x, x^= y
#define INF 0x3f3f3f3f
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define dep(i,a,b) for(int i=(a);i>=(b);--i)
#define scan1(x) scanf("%d",&x)
#define scan2(x,y) scanf("%d%d",&x,&y)
#define scan3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define scanll1(x) scanf("%lld",&x)
#define scanll2(x,y) scanf("%lld%lld",&x,&y)
#define scanll3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define lowbit(x) (x&(-x))
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int N=2e5+20;
const int MAX=10000007;
inline int read() {
    char c=getchar();int x=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0',c=getchar();}
    return x*f;
}

inline void out(int x) {   
	if(x>9) out(x/10);   
	putchar(x%10+'0'); 
} 
char s[20];
double p=acos(-1);
int main(){
	double r;
	cin>>r;
	printf("%.2f\n",p*2*r);
	return 0;
}

Measured memory_bytes: 3804
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
using namespace std;
using ll = long long;
constexpr int mod = 1e9 + 7;

void swap(int &x, int &y)
{
    int tmp = x;
    x = y;
    y = tmp;
}
int main()
{
    int n, m, sou = 0, w = 0;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        sou += a[i];
    }
    for (int i = 0; i < n; i++)
    {
        if (a[i] * 4 * m < sou)
        {
            continue;
        }
        w++;
        if (w >= m)
        {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;
}


Measured memory_bytes: 256
//============================================================================
//Everyone has a different way of thinking, so God Created us
//   Hope You Respect My Way..,Thank You ):
// Author      : Murad
// Online Judge: Codeforces.cpp & Atcoder.cpp
// Description : Problem name
//============================================================================
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
typedef long long LL;
#define pi 3.1415926536
#define forn(i,a,b)for(int i=a;i<b;i++)
#define ULL unsigned long long
#define MP make_pair
#define ff first
#define ss second
#define endl '\n'
#define INF LL(1e18);
#define _INF INT32_MIN
#define pq priority_queue
#define MM multimap
#define PB push_back
#define EMPP emplace_back
#define vii vector<int>
#define vll vector<LL>
#define ipair pair<int,int>
#define lpair pair<LL,LL>
#define El3zba ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define modd 1000000007
#define sf1(v) scanf("%I64d",&v);
#define sf2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sf3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
//std::transform(s1.begin(), s1.end(), s1.begin(),::tolower);
char alphz[27] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };
float Euclidean(LL x1, LL x2, LL y1, LL y2) {
	return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
}
LL GCD(LL a,LL b) {
	return !b ? a : GCD(b, a % b);
}
LL LCM(LL a, LL b) {
	return (a*b) / GCD(a, b);
}
void PrimeFactor(LL n)
{
	while (n % 2 == 0) {
		//printf("%d ", 2);
//		aa.insert(2);
		n /= 2;
	}
	for (int i = 3; i <= sqrt(n); i += 2)
	{
		if (n%i == 0) {
			//printf("%d ", i);
			//aa.insert(i);
			n /= i;
		}
	}
	if (n > 2){
		//printf("%d ", n);
	//	aa.insert(n);
	};
}
bool Is_Square(LL x) {
	LL l = 0, r = x;
	while (l <= r) {
		LL mid = l + (r - l) / 2;
		if (mid*mid == x)return true;
		if (mid*mid > x)r = mid - 1;
		else l = mid + 1;
	}
	return false;
}
LL Power(LL x, LL y)
{
	LL temp;
	if (y == 0)return 1;
	temp = Power(x, y / 2);
	if (y % 2 == 0)
		return temp*temp;
	else return x*temp*temp;
}
bool Is_Prime(int x) {
	if (x == 2)return 1;
	else if (x % 2 == 0 || x < 2)return 0;
	for (int i = 3; i*i <= x; i += 2)
		if (x%i == 0)return 0;
	return 1;
}
int main()
{
	El3zba;
	/***  بسم الله الرحمن الرحيم   ***/
	int n;
	cin >> n;
	int ans = 1;
	int cnt = 2;
	for (int i = 2; i <= n; i++)
	{
		while (Power(i, cnt) <= n) {
			ans = max((LL)ans, Power(i, cnt)); cnt++;
		}
		cnt = 2;
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
	string s; cin>>s;
	int md = (s[5]-'0')*1000 + (s[6]-'0')*100 + (s[8]-'0')*10+(s[9]-'0');
	cout<< (md<=430? "Heisei":"TBD") <<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void){
  int x;
  scanf("%d",&x);
  int fiveHundred;
  fiveHundred = x/500;
  x%=500;
  int five = x/5;
  printf("%d",fiveHundred*1000+five*5);
  return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python3
import sys


def solve(N, A):
    A = [0] + A + [0]
    C = 0
    for i in range(1, len(A)):
        C += abs(A[i] - A[i-1])
    for i in range(1, len(A)-1):
        print(C - abs(A[i] - A[i-1]) - abs(A[i] - A[i+1]) + abs(A[i-1] - A[i+1]))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


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

int dp[3001][3001];

string getLCS(int len,string s, string t){
	string LCS;
	int i=0,j=0;
	while(len>0)
	{
		if(s[i]==t[j])
		{
			LCS.push_back(s[i]);
			i++;
			j++;
			len--;
		}
		else{
			if(dp[i][j+1]>dp[i+1][j])
				j++;
			else
				i++;
		}
	}
	return LCS;
}

int lenLCS(string& s,string& t,int i,int j){
	if(i>=s.length() || j>t.length()){
		return 0;
	}
	if(dp[i][j]!=-1)
		return dp[i][j];
	
	if(s[i]==t[j])
		return dp[i][j]=1+lenLCS(s,t,i+1,j+1);
	else
		return dp[i][j]=max(lenLCS(s,t,i+1,j),lenLCS(s,t,i,j+1));
}	

string solve(string s,string t){
	memset(dp,-1,sizeof dp);
	int len=lenLCS(s,t,0,0);
	return getLCS(len,s,t);
}

int main(){
	string s,t;
	getline(cin,s);
	getline(cin,t);
	cout<<solve(s,t)<<endl;
	return 0;
}

Measured memory_bytes: 35968
#include<bits/stdc++.h>
using namespace std;
#define ll   long long int
#define T int t; cin>>t; while(t--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define PI 3.141592653589793238462643383
#define pb push_back
#define all(s) s.begin(),s.end()


int main (){
    fast;
    
    int n, m = 1000000007;
    cin>>n;

    int dp[n+1] = {0};
    dp[0] = 1,dp[1] = 0, dp[2] = 0, dp[3] = 1;

    for(int i=4;i<=n;i++){
        for(int j=3;j<=i;j++){
            if(i-j>=0){
                dp[i] = (dp[i] + dp[i-j])%m;
            }
        }
    }
    cout<<dp[n]<<endl;

}

Measured memory_bytes: 3612
#include <stdio.h>
int main(void){
int a;
  int sum=0;
  int i;
  int number[99];
  scanf("%d", &a);
  for (i=1; i<=a; i++){
    scanf("%d", &number[i]);
    if (i%2!=0){
      if (number[i]%2!=0){
        sum++;
      }
    }
  }
  printf("%d", sum);
  return 0;
}

Measured memory_bytes: 1736
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define max0(a,b,c) max(max(a,b),c)
#define min0(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
using Graph = vector<vector<int>>;
typedef long long lint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldouble;
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<ull> ulvec;
typedef vector<double> dvec;
typedef vector<pair<int,int>> pvec;
typedef vector<pair<ll,ll>> plvec;
typedef vector<tuple<ll,ll,ll>> tvec;
typedef vector<string> svec;

int main(){
    ll ans=1;
    ll n;
    cin>>n;
    rep(i,n) ans=ans*(i+1)%mod;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
/*
 * ID: adityaaaaaaaaaaaaaaa
 * LANG: C++
 */
#include <bits/stdc++.h>
using namespace std;

#define fio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mem(x, y) memset(x, y, sizeof x);
#define y1 asdgh
#define int long long
#define double long double
#define endl '\n'
#define PI 3.14159265359

/*-----------------------------------------------------------------------*/

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

/*-----------------------------------------------------------------------*/

// check base cases n = 0 , n = 1
// max / min questions - check for binary search
const int maxn = (int) 1e6 + 6;
const double EPS = 1e-9;
const int INF = (int)1e18 + 18;
const int mod = (int) 1e9 + 7;
int u , v;

signed main() {
    
    fio;
    vector<int> degree(4 , 0);
    for(int i = 0; i < 3; i++){
        cin >> u >> v;
        u--;
        v--;
        degree[u]++;
        degree[v]++;
    }
    int odd = 0;
    for(int i = 0; i < 4; i++){
        if(degree[i] & 1){
            odd++;
        }
    }
    
    if(odd == 2){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    
    
    
    return 0;
    
}


Measured memory_bytes: 256
h, w, k = map(int, input().split())
c = []
for _ in range(h):
    c.append(input())

from itertools import product

ans = 0
for col, row in product(list(range(2**h)), list(range(2**w))):
    col = f"{int(str(bin(col))[2:]):0{h}}"
    row = f"{int(str(bin(row))[2:]):0{w}}"
    _c = []
    for i, is_col in enumerate(col):
        if int(is_col):
            _c.append(c[i])
    new_c = []
    for j, is_row in enumerate(row):
        if int(is_row):
            cur_c_c = []
            for _c_c in _c:
                cur_c_c.append(_c_c[j])
            new_c.append(cur_c_c)
    if sum([el.count("#") for el in new_c]) == k:
        ans += 1



print(ans)


Measured memory_bytes: 9228
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define fi first
#define se second

#define INF 1e+9

typedef pair<int, long> P;

int r,c,n;
long minr=INF, minc=INF;
vector<int> x,y;
vector<long> a;
vector<vector<P> > v; //vertex
vector<long> w; //weight of vertex
vector<bool> visited;

void dfs(int to, long weight){
  visited[to] = true;

  w[to] = weight;

  if(to<r) minr = min(minr, w[to]);
  else     minc = min(minc, w[to]);

  for(auto nxt : v[to]){
    if(!visited[nxt.fi]) dfs(nxt.fi, nxt.se-weight);
  }
}

int main(){
  cin>>r>>c>>n;

  x=vector<int>(n), y=vector<int>(n), a=vector<long>(n);
  v=vector<vector<P> >(r+c, vector<P>()); //vertex
  w=vector<long>(r+c, INF); //weight of vertex

  rep(i,n){
    scanf("%d %d %ld", &x[i], &y[i], &a[i]);
    x[i]--; y[i]--;
    v[x[i]].pb(mp(y[i]+r, a[i]));
    v[y[i]+r].pb(mp(x[i], a[i]));
  }

  visited = vector<bool>(r+c, false);
  rep(i,r+c){
    if(!visited[i]){
      minr=INF; minc=INF;
      dfs(i,0);
      if(minr+minc<0){
        cout<<"No"<<endl;
        return 0;
      }
    }
  }

  rep(i,n){
    if(w[x[i]] + w[y[i] + r] != a[i]){
      cout<<"No"<<endl;
      return 0;
    }
  }

  cout<<"Yes"<<endl;

  return 0;
}


Measured memory_bytes: 18048
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String ans = "";
		for (int i = 0; i < 3; i++) {
			char[] c = sc.next().toCharArray();
			ans += c[i];
		}
		System.out.println(ans);
		sc.close();
	}
}

Measured memory_bytes: 21712
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);  cin.tie(0) ; cout.tie(0);
#define debug(x) cout << #x << " : " << x << endl;
#define pi 3.14159265359
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
using ll = long long int;
using db = double;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<bool> vb;
const int MOD = 1e9+9;
const int N = 2e5 + 5;
vi par(N,-1) , rnk(N, 1);



void make_set()
{
  for(int x = 0 ; x < N ; x++)
    par[x] = x;
}


int find_set(int x)
{
    if ( x == par[x])
        return x;
    return par[x] = find_set(par[x]);
}

void merge_set(int a , int b)
{
    int par_a = find_set(a) , par_b = find_set(b);
    if (par_a == par_b) return;
    if (rnk[par_a] < rnk[par_b])
        swap(par_a , par_b);
    par[par_b] = par_a;
    rnk[par_a] += rnk[par_b];
}


void solve()
{
    int n , m;
    cin >> n >> m;
  	make_set();
    while(m--)
    {
        int a , b;
        cin >> a >> b;
       // if(par[a] == -1) make_set(a);
        //if(par[b] == -1) make_set(b);
        merge_set(a,b);
    }


    int ans = *max_element( rnk.begin() , rnk.end());
    if ( m == 0)
        cout << m << endl;
    else
    cout << ans<< endl;

    
}

int main()
{
//  #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin); 
//     freopen("output.txt", "w", stdout);
//  #endif
    fastio;

    ll t = 1;
    // cin >> t;
    while(t--)
       solve();
    return 0;
}


Measured memory_bytes: 4696
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <random>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
struct FIO{FIO(){std::cin.tie(0);std::cout.tie(0);std::ios_base::sync_with_stdio(0);std::cout<<std::fixed<<std::setprecision(15);}}fIO;
/*-*/

int main() {
	lnt x,k,d;
	std::cin >> x >> k >> d;
	if(x<0) x=-x;
	lnt y=x/d;
	if(y>=k) {
		print(x-k*d);
		return 0;
	}
	k-=y;
	if(k&1) {
		debug("B");
		print(std::abs(x-(y+1)*d));
	} else {
		print(x-y*d);
	}
}


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

using namespace std;

#define int long long

const int N = 3e5 + 5 , mod = 1e9 + 7;

//void add(int &x , int y){
//	x += y;
//	if(x >= mod)
//		x -= mod;
//}

char s[N];

long long n , ans;

long long f[N][3][3];

void add(long long &a, long long b) {
	a += b, ((a > mod) ? (a -= mod) : 0);
}

main() {
	scanf("%s", s + 1);
	n = strlen(s + 1);
	f[0][0][0] = 1;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < 3; j++) {
			for(int k = 0; k < 3; k++) {
				if(s[i + 1] != '0') {
					if(k)
						add(f[i + 1][j][k - 1], f[i][j][k]);
					else add(f[i + 1][min(j + 1, (long long)2)][k], f[i][j][k]);
				}
				if(s[i + 1] != '1') {
					if(k == 2)
						add(f[i + 1][j][1], f[i][j][k]);
					else add(f[i + 1][j][k + 1], f[i][j][k]);
				}
			}
		}
	}
	for(int i = 0; i < 3; i++)
		for(int j = 0; j <= i; j++)
			add(ans, f[n][i][j]);
	cout << ans;
	return 0;
}

Measured memory_bytes: 21632
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>0;--i)
#define CI cin>>
#define CO cout<<
#define EN <<endl
#define all(x) (x).begin(),(x).end()
using namespace std;

template <typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

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

int dp[1005][1005] = {};

int main() {
	int a,b; CI a>>b;
	int memo[1000] = {};

	for (int i = 1; i <= 999; i++) {
		memo[i] = memo[i - 1] + i;
		if (memo[i-1] - a==memo[i]-b) { CO memo[i-1] - a EN; break; }
	}

	

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main(){
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	int co = 0;
	int b = 0;
	for (int i = 0; i < 3; i++) {
		if (a[i] % 2 == 0) {
			co++;
		}
	}
	if (co == 2) {
		for (int i = 0; i < 3; i++) {
			if (a[i] % 2 == 0) {
				a[i]++;
			}
		}
		sort(a, a + 3);
		b++;
	}
	else if(co==1){
		for (int i = 0; i < 3; i++) {
			if (a[i] % 2 == 1) {
				a[i]++;
			}
		}
		sort(a, a + 3);
		b++;
	}
	cout << (a[2] - a[0] + a[2] - a[1]) / 2 + b << endl;
}

Measured memory_bytes: 256
use proconio::marker::Bytes;
use proconio::{fastout, input};
use std::collections::HashSet;

#[fastout]
fn main() {
    input! {
        n: usize,
        s: [Bytes; n],
    }

    let mut u: HashSet<Vec<u8>> = HashSet::new();
    for t in s.into_iter() {
        u.insert(t);
    }
    println!("{}", u.len());
}


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

int main(){
	int t,c;
	while(1){
		cin>>t;
		if(t==0) break;
		for(int i=0;i<9;i++){
			cin>>c;
			t-=c;
		}
		cout<<t<<endl;
	}
	return 0;
}


Measured memory_bytes: 3100
//#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
//#include <cmath>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <list>
#include <queue>
#include <set>
using namespace std;

int main(void){

	for (int i = 1; i < 10; i++){
		for (int j = 1; j < 10; j++){
			cout << i << "x" << j << "=" << i*j << endl;
		}
	}

	return 0;
}

/*
for(i=0;i<N;i++){
cin >> X[i];
}


for(i=0;i<N;i++){
for(j=0;j<N;j++){
cin >> X[i][j];
}
}
*/

Measured memory_bytes: 1116