akhauriyash/Code-Regression huggingface dataset:
import sys
n, m = map(int, input().split())
di = set()
errc = [0] * (n+1)
res = 0
err = 0
for _ in range(m):
    p, s = sys.stdin.readline().split()
    p = int(p)
    if p in di:
        continue
    if s == 'AC':
        di.add(p)
        res += 1
        err += errc[p]
    else:
        errc[p] += 1
print(res, err)

Measured memory_bytes: 47580
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int N;
  cin >> N;
  int copyN = N;
  int waru =10000000;
  int No;
  int total;
  int j = 0;
  while (j < 8) {
   No = copyN/waru;
    
    total += No;
    copyN = copyN - No*waru;
    waru /=10;
    j++;
  }
 if( N%total == 0){
   cout << "Yes" << endl;
 }else{
   cout << "No" << endl;
 }
 }

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



int main() {
    long long l,r;
    cin>>l>>r;

    if(r-l+1<2019) {
        long long mi = 2018; 
        for (long long i=l; i <=r; i++) {
            for(long long j=i+1;j<=r;j++){
                mi = min(mi,(i*j)%2019);
            }
        }
        cout<<mi<<endl;
    }else{
        cout<<0<<endl;
    }


}






Measured memory_bytes: 256
def main():
  n,*h=map(int,open(0).read().split())
  k=h[0]
  count=0
  ans=0
  for i in h[1:]:
    if k>=i:
      count+=1
    else:
      count=0
      
    ans=max(ans,count)
    k=i
  
  print(ans)
  
if __name__=="__main__":
  main()

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

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

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

  int n; std::cin >> n;
  vector<pair<ll, ll>> a;
  rep(i, n) {
    int ai; std::cin >> ai;
    a.pb({ai, i+1});
  }
  sort(rrng(a));
  vvl dp(n+1, vl(n+1));
  rrep(i, n) {
    rep(j, i) {
      chmax(dp[i][j+1], dp[i-1][j] + a[i-1].fi*abs(a[i-1].se-(j+1)));
      chmax(dp[i][j], dp[i-1][j] + a[i-1].fi*abs(a[i-1].se-(n-((i-1)-j))));
    }
  }
  ll ans = 0;
  rep(i, n) chmax(ans, dp[n][i]);
  std::cout << ans << "\n";
}


Measured memory_bytes: 34592
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  string s;
  cin >> s;
  int n = s.size();
  reverse(all(s));
  vector<vi> dp(n + 1, vi(2, 1e8));
  dp[0][0] = 0;
  rep(i, n) rep(j, 2) {
    int d = s[i] - '0';
    int ni = i + 1;
    dp[ni][0] = min(dp[ni][0], dp[i][j] + d + j);
    dp[ni][1] = min(dp[ni][1], dp[i][j] + 10 - d - j);
  }
  cout << min(dp[n][0], dp[n][1] + 1) << endl;
}

Measured memory_bytes: 55940
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int x,y;
  cin >> x >> y;
  int b2 = y - 2*x;
  bool ok = true;
  if (b2 % 2 == 1 || b2 < 0) ok = false;
  int b = b2/2;
  int a = x - b;
  if (a < 0) ok = false;
  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 3656
#include <cstdio>
#include <algorithm>
using namespace std;

int main()
{
	int a[3];
	
	scanf("%d %d %d", &a[0], &a[1], &a[2]);
	
	sort(a, a + 3);
	
	printf("%d %d %d\n", a[0], a[1], a[2]);
	
	return (0);
}

Measured memory_bytes: 1040
n = int(input())
a = list(map(int,input().split()))
cnt = 0
id = 1
while a != []:
    if len(a)==1:
        cnt += 1
        break
    if a[0] == a[1]:
        while a[id-1] == a[id] and id <= len(a)-1:
            id += 1
            if id == len(a):break
        if id == n:
            cnt = 1
            break
        del(a[:id-1])
        id = 1
    if a[0] > a[1]:
        while  a[id-1] >= a[id] and id <= len(a)-1:
            id += 1
            if id == len(a):break
    elif a[0] < a[1]:
        while a[id-1] <= a[id] and id <= len(a)-1:
            id += 1
            if id == len(a):break
    cnt += 1
    del(a[:id])
    id = 1


print(cnt)

Measured memory_bytes: 14480
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
#define pb push_back

using ll = long long;
using namespace std;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
const int INFint = 1e9;
const ll INFll = 1e18;
ll MOD=1e9+7;

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

// aのn乗をMODで割りながら計算する
ll modpow(ll a, ll n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1; // right shift
  }
  return res;
}

// MODを法としたaの逆元を計算する
ll modinv(ll a) {
  return modpow(a, MOD - 2);
}

int main(){
  int A,B;
  cin>>A>>B;
  for (int i(1);i<200000;i++){
    if (floor(i*0.08) == A && floor(i*0.1) == B){
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;



/*
 Warshall–Floyd Algorithm
 */
void warshall_floyd(ll N, vector<vector<ll>>& d){
  REP(k,N){
    REP(i,N){
      REP(j,N){
        d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
      }
    }
  }
}

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

  ll H, W;
  cin >> H >> W;
  vector<string> s(H);
  REP(i,H) { cin >> s[i]; }

  // distance
  vector<vector<ll>> d(H*W, vector<ll>(H*W,INF));

  // create graph
  REP(i,H){
    REP(j,W){
      d[i*W+j][i*W+j] = (s[i][j]=='.') ? 0 : INF;
      if (i>0) d[i*W+j][(i-1)*W+j] = (s[i][j]=='.') ? 1 : INF;
      if (i<H-1) d[i*W+j][(i+1)*W+j] = (s[i][j]=='.') ? 1 : INF;
      if (j>0) d[i*W+j][i*W+j-1] = (s[i][j]=='.') ? 1 : INF;
      if (j<W-1) d[i*W+j][i*W+j+1] = (s[i][j]=='.') ? 1 : INF;
    }
  }

  warshall_floyd(H*W, d);

  ll ans = -INF;
  REP(i,H*W){
    REP(j,H*W){
      if (s[i/W][i%W]=='.' && s[j/W][j%W]=='.') ans = max(ans, d[i][j]);
    }
  }

  cout << ans << "\n";
  return 0;
}


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

#define SIZE 200000


using namespace std;

int main() {
    unsigned long long int A,C,D,i,j,k,N,M,K,Q,X,dix;
    double B,B2;
  //  long long int A[100][100];

 cin >> A >> B;

if ((A == 0) || (B == 0))
  cout << 0 << endl;
else {
 B2 = round(B*100);
 C = A*(unsigned long long int) B2;
 D = C/100;

 cout << D << endl;
}
  return 0;

}


Measured memory_bytes: 3776
a, b, c = map(int, input().split())

list_iroha = [a, b, c]
count = 0
if a + b + c == 17:
    for i in list_iroha:
        if i == 5:
            count += 1
            if count == 2:
                print("YES")
                exit()
print("NO")
exit()


Measured memory_bytes: 2940
#include "stdio.h"

int H,W;
int K;
char map[1001][1001] = {};
int width[3][1002][1002] = {};
int height[3][1002][1002] = {};
int box[4];
int ans[3];

int main() {
	scanf("%d %d", &H, &W);
	scanf("%d", &K);
	for (int i = 0; i < H; i++) {
		scanf("%s", map[i]);
	}
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			for (int k = 0; k < 3; k++) {
				width[k][i][j] = width[k][i][j - 1];
			}
			if (map[i-1][j-1] == 'J')width[0][i][j]++;
			else if (map[i-1][j-1] == 'O')width[1][i][j]++;
			else width[2][i][j]++;
		}
	}
	for (int i = 0; i < K; i++) {
		ans[0] = ans[1] = ans[2] = 0;
		scanf("%d %d %d %d", &box[0], &box[1], &box[2], &box[3]);
		for (int j = box[0]; j <= box[2]; j++) {
			for (int k = 0; k < 3; k++) {
				ans[k] += width[k][j][box[3]] - width[k][j][box[1]-1];
			}
		}
		printf("%d %d %d\n", ans[0], ans[1], ans[2]);
	}
	return 0;
}

Measured memory_bytes: 15256
using System;

public class S
{



    public static void Main()
	{
        /*
        var input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        solver(input[0],input[1],input[2]);
        */
        solver(Console.ReadLine());
        //solver("01101101010100100111");
    }

    public static void solver(string S){

        var zeroCnt = 0;
        var oneCnt = 0;

        foreach(var tgt in S.ToCharArray()){
            if(tgt == '0') zeroCnt++;
            if(tgt == '1') oneCnt++;
        }

        Console.WriteLine(S.Length - (S.Length - ((zeroCnt > oneCnt) ? oneCnt*2 : zeroCnt*2)));

    }

    public static long lower_bound(long[] array, long input){
        var left = 0;
        var right = array.Length-1;
        var mid =0;
        while(right >= left){
            mid = left + (right - left)/2;
            if(array[mid] == input){
                return mid;
            }
            if(array[mid] > input){
                right = mid-1;
            }else{
                left = mid+1;
            }
        }

        return right;
    }

}

Measured memory_bytes: 13176
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

#define EPS (1e-7)

int main() {
  ll x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  const ll A = x2 - x1;
  const ll B = y2 - y1;
  const ll x3 = x2 - B;
  const ll y3 = y2 + A;
  const ll x4 = x3 - A;
  const ll y4 = y3 - B;

  cout << x3 << " " << y3 << " " << x4 << " " <<   y4;

  return 0;
}


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

int main() {
  int a, b, c, d;
  int cnt = 1;
  ios::sync_with_stdio(0);
  cin.tie(0);

  cin >> a >> b >> c >> d;

  while(a > 0 && c > 0) {
    if(cnt % 2 != 0)
      c -= b;
    else
      a -= d;
    cnt++;
  }

  a <= 0 ? cout << "No" : cout << "Yes";
  return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <sstream>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <set>
#include <memory>

struct TestData
{
  int testNum;
  std::string input;
  std::string expectedOutput;
};

struct TestResult
{
  std::string testOutput;
  bool testPassed;
};

void testSolution();
TestResult runTestCase(const TestData& testData);
std::string formatResult(const TestData& testData, const TestResult& testResult);
void solution(std::istream& is, std::ostream& os);
bool canPerformoOperationOn(std::vector<int>& numbers);
int calculateDifference(int index1, int index2, std::vector<int>& numbers);

static const bool IS_TESTING = false;

// define test data
static const std::vector<TestData> testDatas = {
  {1, "5\n1 2 1 1 3\n", "Yes\n"},
  {2, "4\n1 3 2 1\n", "No\n"},
  {3, "5\n1 2 3 4 5\n", "Yes\n"},
  {4, "1\n1000000000\n", "Yes\n"},
  {5, "2\n1 2\n", "Yes\n"},
  {6, "2\n1 1\n", "Yes\n"},
  {7, "2\n1 0\n", "Yes\n"},
  {8, "2\n3 1\n", "No\n"},
  {9, "3\n5 4 3\n", "No\n"},
  {10, "4\n4 3 3 2\n", "No\n"},
  {10, "5\n4 3 3 3 2\n", "No\n"},
};

int main()
{
  if (IS_TESTING)
    testSolution();
  else
    solution(std::cin, std::cout);

  return 0;
}

void testSolution()
{
  for (const auto& testData : testDatas) {
    auto testResult = runTestCase(testData);

    std::cout << formatResult(testData, testResult);
  }
}

TestResult runTestCase(const TestData& testData)
{
    std::istringstream iss {testData.input};
    std::ostringstream oss {};

    solution(iss, oss);

    auto testOutput = oss.str();
    auto testPassed = testData.expectedOutput.compare(testOutput) == 0;
    
    return {testOutput, testPassed};
}

std::string formatResult(const TestData& testData, const TestResult& testResult)
{
  std::ostringstream oss {};

  oss << "Test " << std::setw(2) << testData.testNum << ": "
    << (testResult.testPassed ? "Passed!" : "Failed!") << std::endl;
  
  oss << "\tExpected: " << testData.expectedOutput << "\tActual  : " << testResult.testOutput << std::endl;

  return oss.str();
}

// solution to the problem
void solution(std::istream& is, std::ostream& os)
{
  // read from input
  int numCount; is >> numCount;
  std::vector<int> numbers(numCount);
  for (auto i = 0; i < numCount; ++i) {
    is >> numbers[i];
  }

  os << (canPerformoOperationOn(numbers) ? "Yes" : "No") << std::endl;
}

bool canPerformoOperationOn(std::vector<int>& numbers)
{
  if (numbers.size() == 1) return true;

  auto oneBeforeLastIdx = numbers.size() - 2;
  auto hasDecremented = false;
  for (auto i = 0; i <= oneBeforeLastIdx; ++i) {
    auto difference = calculateDifference(i, i + 1, numbers);
    
    if (difference > 1) return false;

    if (difference == 1 && hasDecremented) return false;
    
    if (difference == 1) hasDecremented = true;

    if (difference < 0) hasDecremented = false;
  }

  return true;
}

int calculateDifference(int index1, int index2, std::vector<int>& numbers)
{
  return numbers[index1] - numbers[index2];
}

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

int main(){
	int a,b,c;
	int kawaisou=0;
	cin>>a>>b>>c;
	if(a==b&&a!=c)kawaisou=1;
	if(b==c&&b!=a)kawaisou=1;
	if(c==a&&c!=b)kawaisou=1;
	if(kawaisou==1)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;

	return 0;

}


Measured memory_bytes: 256
n,k=map(int,input().split())
al=list(map(int,input().split()))
al.sort()
tl=[]
pv=al[0]
cnt=0
for i in al:
    if i==pv:
        cnt+=1
    else:
        tl.append(cnt)
        pv=i
        cnt=1
tl.append(cnt)
tl.sort()
if len(tl)<=k:
    print(0)
else:
    print(sum(tl[:len(tl)-k]))

Measured memory_bytes: 25748
#include<bits/stdc++.h>
using namespace std;
const int MAX_N = 1<<17;

int n,dat[2*MAX_N-1];

void init(int n_){
  n=1;
  while(n<n_)n*=2;
  for(int i=0; i<2*n-1; i++)dat[i]=INT_MAX;
}

void update(int k, int a){
  k += n-1;
  dat[k] = a;
  while(k>0){
    k = (k-1)/2;
    dat[k] = min(dat[k*2+1] , dat[k*2+2]);
  }
}

int query(int a, int b, int k, int l, int r){
  if(r<=a || b<=l)return INT_MAX;
  if(a<=l && r<=b)return dat[k];
  else{
    int vl = query(a,b,k*2+1,l,(l+r)/2);
    int vr = query(a,b,k*2+2,(l+r)/2,r);
    return min(vl,vr);
  }
}

int main(){

  int q;
  cin >> n >> q;

  init(n);
  
  for(int i=0,com,x,y; i<q; i++){
    cin >> com >> x >> y;
    if(com == 0)update(x,y);
    if(com == 1)cout << query(x,y+1,0,0,n)<<endl;
  }

  return 0;
}

Measured memory_bytes: 4100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> broken(n+1);
    int a; 
    for(int i=0; i<m; i++){
        cin >> a;
        broken[a] = 1;
    }

    vector<int> dp(n+2);
    dp[n] = 1;
    for(int i=n-1; i >= 0; i--){
        if(broken[i]){
            dp[i] = 0;
            continue;
        }
        dp[i] = (dp[i+1]+dp[i+2]) % mod;
    }
    cout << dp[0] << endl;
    return 0;
}

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

using namespace std;

int main() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      int now = i * j + (n-i) * (m-j);
      if (now == k) {
        puts("Yes");
        return 0;
      }
    }
  } 
  puts("No");
  return 0;
}

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

using namespace std;

int main(){
	bool f[4];
	memset(f, false, sizeof(f));
	int a , b;
	cin >> a >> b;
	f[a] = true;
	f[b] = true;
	for (int i = 1; i <= 3; i++){
		if (!f[i])
			printf("%d\n", i);
	}
	return 0;
}

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

namespace ConsoleApp15
{
    class Class396
    {
        static void Main()
        {
            var NK = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = NK[0], K = NK[1];
            var p = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Array.Sort(p);

            int ans = 0;
            for(int i = 0; i < K; i++)
            {
                ans += p[i];
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 28408
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;


#[fastout]
fn solve() {
    const MOD: usize = 1_000_000_007;
    const INF: usize = std::usize::MAX;
    
    input!{
        n: usize, k: usize,
        a_vec: [usize; n]
    }

    for i in 0..n {
        if i < k { continue; }

        if a_vec[i] > a_vec[i-k] {
            println!("Yes")
        } else {
            println!("No")
        }
    }

    println!("", );
}

fn main() {
    solve()
}

#[cfg(test)]
mod test {
    use super::solve;
}


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

int main() {
    string s1, s2;
    cin >> s1 >> s2;
    int dp[s1.size() + 1][s2.size() + 1];
    memset(dp, 0, sizeof(dp));
    for (int i = 0; i <= s1.size(); ++i) dp[i][0] = i;
    for (int j = 0; j <= s2.size(); ++j) dp[0][j] = j;
    for (int i = 0; i < s1.size(); ++i) {
        for (int j = 0; j < s2.size(); ++j) {
            int a = (s1[i] == s2[j]) ? 0 : 1;
            dp[i + 1][j + 1] = min(dp[i][j] + a, min(dp[i + 1][j] + 1, dp[i][j + 1] + 1));
        }
    }
    cout << dp[s1.size()][s2.size()] << endl;

    return 0;
}


Measured memory_bytes: 7124
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main()
{
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    for(int i = 0; i < b; i++)
    {
        for(int j = 0; j < a; j++)
        {
            cout << 0;
        }
        for(int j = 0; j < w-a; j++)
        {
            cout << 1;
        }
        cout << endl;
    }
    for(int i = 0; i < h-b; i++)
    {
        for(int j = 0; j < a; j++)
        {
            cout << 1;
        }
        for(int j = 0; j < w-a; j++)
        {
            cout << 0;
        }
        cout << endl;
    }
}


Measured memory_bytes: 1280
import sys


def solv(c1, c2, c3):
    cards = range(1, 11)
    for c in [c1, c2, c3]:
        cards.remove(c)
    hand = c1 + c2
    r = filter(lambda x: x + hand <= 20, cards)
    if len(r) >= 4:
        return 'YES'
    else:
        return 'NO'



for line in sys.stdin:
    c1, c2, c3 = map(int, line.strip().split(' '))
    print solv(c1, c2, c3)

Measured memory_bytes: 4228
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder res = new StringBuilder();
		int n = sc.nextInt();
		int[] A = new int[n + 2];
		A[0] = A[n+1] = 0;
		int sum = 0;
		for(int i = 1; i <= n; i++) A[i] = Integer.parseInt(sc.next());
		for(int i = 0; i < A.length-1; i++) sum += Math.abs(A[i] - A[i+1]);
		for(int i = 1; i <= n; i++) {
			int dif = Math.abs(A[i-1] - A[i+1]) - Math.abs(A[i-1] - A[i])
					 - Math.abs(A[i] - A[i+1]);
			res.append(sum + dif + "\n");
		}
		System.out.print(res);
	}
}


Measured memory_bytes: 49992
n, m = map(int, input().split())
a = [[] for i in range(8)]
for i in range(n):
    x, y, z = map(int, input().split())
    a[0] += [x+y+z]
    a[1] += [x+y-z]
    a[2] += [x-y+z]
    a[3] += [x-y-z]
    a[4] += [-x+y+z]
    a[5] += [-x+y-z]
    a[6] += [-x-y+z]
    a[7] += [-x-y-z]
print(max(sum(sorted(a[i])[-m:]) for i in range(8)) if m > 0 else 0)


Measured memory_bytes: 3432
#include <stdio.h>

int main(){
    int n,k,l[50];
    int i,j;
    int tmp,sum = 0;

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

    for(i = 0;i < n;i++){
        scanf("%d",&l[i]);
    }

    for(i = 0;i < n - 1;i++){
        for(j = n - 1;j > i;j--){
            if(l[j] > l[j - 1]){
                tmp = l[j];
                l[j] = l[j - 1];
                l[j - 1] = tmp;
            }
        }
    }

    for(i = 0;i < k;i++){
        sum += l[i];
    }

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

    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define int long long
/* #define double long double */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
#define MOD 1000000007
using namespace std;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> P;
#define rrep(i,a,b) for(int i=a;i>=b;i--)

signed main(){
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];

    int kane = 1000;
    int kabu = 0;

    rep(i, n-1){
        if(a[i] > a[i+1]){
            /* 翌日の方が安い=株を売る */
            int sell = kabu;
            kane += a[i] * sell;
            kabu -= sell;
            /* cout << "sell " << kane << " " << kabu << endl; */
        }else if(a[i] < a[i+1]){
            /* 株をbuy株買う */
            int buy = kane / a[i];
            kabu += buy;
            kane -= a[i] * buy;
            /* cout << "buy " << kane << " " << kabu << endl; */
        }
    }

    kane += kabu * a[n-1];
    cout << kane << endl;
}

Measured memory_bytes: 3632
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace AtCoder
{
	public class ABC
	{
		static public void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
			Solve(args);
			Console.Out.Flush();
		}

		private const int mod = 1000000007;  // 10^9+7

		static public void Solve(string[] args)
		{
			//string s = Console.ReadLine();
			//int n = int.Parse(Console.ReadLine());
			//long x = long.Parse(Console.ReadLine());
			int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();
			int n = vs[0];
			int k = vs[1];

			long ans = 0;
			long min = 0, max = 0;
			for (int i = 0; i < n + 1; i++) {
				min += i;
				max += (n - i);
				//System.Diagnostics.Debug.WriteLine($"{i} {min} {max} {max - min + 1}");
				if (i + 1 >= k) {
					ans += max - min + 1;
					ans %= mod;
				}
			}
			Console.WriteLine(ans);
		}
	}
}


Measured memory_bytes: 28260
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;

void solve(){
    int n;
    cin>>n;
    vector<int> h(n+5), dp(n+5);
    for(int i=1;i<=n;i++)cin>>h[i];
    h[0]=h[1];
    for(int i=1;i<=n;i++){
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout<<dp[n]<<endl;
}

int main()
{
    //freopen("IN.txt","r",stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


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

int dp[200002][26];
int d[200002];

int main()
{
    string a;
    cin >> a;
    int n = a.size();
    for(int j = 0; j < 26; j++) dp[n][j] = n;
    int l[26] {0};
    for(int i = n - 1; i >= 0; i--){
        for(int j = 0; j < 26; j++) dp[i][j] = dp[i + 1][j];
        int r = 10000000;
        for(int j = 0; j < 26; j++) r = min(r, l[j]);
        l[a[i] - 'a'] = r + 1;
        d[i] = r + 1;
        dp[i][a[i] - 'a'] = i;
    }
    int now = 0;
    while(true){
        int r = 10000000;
        int ar = -1;
        for(int j = 25; j >= 0; j--){
            if(d[dp[now][j]] <= r){
                r = d[dp[now][j]];
                ar = j;
            }
        }
        cout << char('a' + ar);
        if(r == 0) break;
        now = dp[now][ar] + 1;
    }
}

Measured memory_bytes: 21636
N = int(input())
L = list(map(int, input().split()))
ans = 0

for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            if L[i] != L[j] and L[i] != L[k] and L[j] != L[k]:
                if L[i] + L[j] > L[k] and L[j] + L[k] > L[i] and L[k] + L[i] > L[j]:
                    ans += 1

print(ans)

Measured memory_bytes: 9152
var input=require("fs").readFileSync("/dev/stdin","utf8");
input=input.split("\n");

var str,oup;
var H,W,h,w;
var i=0;

while(1){
    str=input[i].split(" ");
    H=str[0];
    W=str[1];
    if(H==0&&W==0){
        break;
    }
    
    for(h=0;h<H;h++){
        oup="";
        for(w=0;w<W;w++){
           //偶数列
           if(h%2==0){
               if(w%2==0){
                   oup+="#"
               }
               else{
                   oup+="."
               }
           }
           //奇数列
           else{
               if(w%2==0){
                   oup+="."
               }
               else{
                   oup+="#"
               }
               
           }
        }
        console.log(oup);
    }
    
    console.log();
    i++;
}


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

int main(){
    int r;
    cin >> r;
    int g;
    cin >> g;
    cout << 2*g-r << endl;
}


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

typedef long long ll;
ll n, k, ans;

int main()
{
	cin >> n >> k;
	if(k == 0) {
		cout << n * n;
		return 0;
	}
	for(ll i=k+1;i<=n;i++) {
		for(ll j=0;j<=n;j+=i) {
			ans += max(0ll, min(i-1, n-j) - k + 1);
		}
	}
	cout << ans;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int W=0,H=0,x=0,y=0,r=0;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    if(x-r>=0 && x+r<=W && y-r>=0 && y+r<=H){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

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

#define MAX 1000
#define VMAX 10000

/**
 * 4 -> 7 -> 5 -> 1 -> 4
 * => sum = 17
 * => cycle = 4
 * => min = 1
 * => sum + (cycle - 2) * min = 17 + (4 - 2) * 1 = 17 + 2 = 19
 * 
 * (i-i)   1 and 4: swap 1 and 4 => 4 -> 7 -> 5 -> 4: cost 5
 * (i-ii)  4 and 7: swap 4 and 7 => 4 -> 5 -> 4: cost 11
 * (i-iii) 4 and 5: swap 4 and 5 => cost 9
 * sum: 5 + 11 + 9 = 25
 * 
 * (ii-i)   1 and 5: swap 1 and 5 => 4 -> 7 -> 1 -> 4: cost 6
 * (ii-ii)  1 and 7: swap 1 and 7 => 4 -> 1 -> 4:      cost 8
 * (ii-iii) 1 and 4: swap 1 and 4 =>                   cost 5
 * sum: 6 + 8 + 5 = 19
 * 
 * swap count:
 * => at least one exchange occurs for each element: sum of element's number
 * => exchange with min value occurs n - 1 times (but reduce once because first time is counted by the above step): (n - 2) * min value
 * 
 * first part:  1 -> 2 -> 1
 * second part: 7 -> 8 -> 10 -> 9 -> 7
 * 
 * 7 * (n - 2) = 14 (i)
 * 1 * (n - 2) = 2  (ii)
 * 1 + 7 = 8        (iii)
 * (i) < (ii) + (iii)
 * 2 -> 7 -> 8 -> 10 -> 9 -> 1 -> 2
 * 
 * (2 * (min(w_i) + x)) - ((n-1) * (min(w_i) - x))
 * 
 * cost = sum(w_i) + (n - 2) * min(w_i)  + 2 * (min(w_i) + X) - (n - 1) * (min(w_i) - x)
 *      = sum(w_i) + ((n - 2) - (n - 1) + 2) * min(w_i) + (2 + (n - 1)) * x
 *      = sum(w_i) + min(w_i) + (n + 1) * x
 **/
int min(int a, int b) {
    return (a < b) ? a : b;
}

int cycle_cost(int sum, int min_w, int min_v, int length) {
    int single_cost = sum + (length - 2) * min_w;
    int cost_with_min = sum + min_w + (length + 1) * min_v;
    return min(single_cost, cost_with_min);
}

int solve(int A[], int B[], int T[], int N, int min_v) {
    int ans = 0;

    bool V[MAX];
    for (int i = 0; i < N; i++) {
        B[i] = A[i];
        V[i] = false;
    }
    sort(B, B+N);
    for (int i = 0; i < N; i++) T[B[i]] = i;
    for (int i = 0; i < N; i++) {
        if (V[i]) continue;
        int cur = i;
        int sum_of_cycle = 0;
        int min_w = VMAX;
        int length = 0;
        while (true) {
            V[cur] = true;
            length++;
            int cur_val = A[cur];
            min_w = min(min_w, cur_val);
            sum_of_cycle += cur_val;
            cur = T[cur_val];
            if (V[cur]) break;
        }
        ans += cycle_cost(sum_of_cycle, min_w, min_v, length);
    }
    return ans;
}

int main() {
    int A[MAX], B[MAX], T[VMAX+1], N, sum, min_w, min_v = VMAX, length;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        min_v = min(min_v, A[i]);
    }
    int ans = solve(A, B, T, N, min_v);
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3184
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
from collections import deque, Counter
def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math
INF = 10**10
def bfs(graph, visited, position, root):
    visited[root] = 1
    position[root] = 0
    deq = deque([root])
    while(deq):
        cur = deq.pop()
        # print(cur)
        for nxt, dist in graph[cur]:
            if position[cur] + dist != position[nxt]:
                if position[nxt] != INF:
                    return False
                else:
                    position[nxt] = position[cur] + dist
            if not visited[nxt]:
                deq.append(nxt)
                visited[nxt] = 1

    return True

def main():
    n,m = getList()
    position = [INF for i in range(n)]
    graph = [[] for i in range(n)]
    for i in range(m):
        a,b,c = getList()
        graph[a-1].append((b-1, c))
        graph[b - 1].append((a-1, -c))

    # print(graph)
    visited = [0 for i in range(n)]
    for i in range(n):
        if not visited[i]:
            # print("===========")
            res = bfs(graph, visited, position, i)
            if res == False:
                print("No")
                return

    print("Yes")

if __name__ == "__main__":

    main()

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

int A, B, C, D;

int solve()
{
	if (B < C) return 0;
	if (D < B) return D-C;
	return B - C;
}

int main(int argc, char **argv)
{
	cin >> A >> B >> C >> D;

	if (C < A)
	{
		int tmp = A;
		A = C;
		C = tmp;

		tmp = B;
		B = D;
		D = tmp;
	}

	std::cout << solve() << std::endl;
}


Measured memory_bytes: 256
n,W=map(int,input().split())
wv=[[int(j) for j in input().split()] for i in range(n)]
dp=[[0]*110000 for i in range(110)]
#print(dp)

for i in range(1,n+1):
  for j in range(W+1):
    dp[i][j]=dp[i-1][j]
    if j-wv[i-1][0]>=0:
      dp[i][j]=max(dp[i][j],
                   dp[i-1][j-wv[i-1][0]]+wv[i-1][1])
      
print(dp[n][W])

Measured memory_bytes: 129432
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPP(i, n) for(int i = 2; i < n; i++)

using namespace std;

typedef long long ll;
const ll MOD = 1000000007;

int main() {
    int n, m; cin >> n >> m;
    vector<ll> a(n+1, 1);
    REP(i,m) {
        int index; cin >> index;
        a[index] = 0;
    }
    vector<ll> dp(n+1, 0);
    dp[0] = 1;
    dp[1] = 1;
    REPP(i,n+1) {
        if(a[i-1]) dp[i] += dp[i-1];
        if(a[i-2]) dp[i] += dp[i-2];
        dp[i] %= MOD;
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<stdlib.h>
#include<math.h>
#include<set>
#include<map>
#include<vector>
using namespace std;
const long long M=1000000007ll;
int n,m,a[2005],b[2005],i,j;
long long f[2005][2005][4];
int main()
{
	scanf("%d %d",&n,&m);
	for(i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(j=1;j<=m;j++)
		scanf("%d",&b[j]);
	for(i=0;i<=n;i++)
		f[i][0][0]=1;
	for(i=0;i<=m;i++)
		f[0][i][0]=1;
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
		{
			f[i][j][1]=f[i][j-1][1]+f[i][j-1][3];
			f[i][j][2]=f[i-1][j][2]+f[i-1][j][3];
			f[i][j][0]=f[i-1][j-1][0]+f[i-1][j-1][2]+f[i-1][j-1][3]+f[i-1][j-1][1];
			if(a[i]==b[j])
				f[i][j][3]=f[i-1][j-1][0]+f[i-1][j-1][2]+f[i-1][j-1][3]+f[i-1][j-1][1];
			f[i][j][0]%=M;
			f[i][j][1]%=M;
			f[i][j][2]%=M;
			f[i][j][3]%=M;
		}
	cout<<(f[n][m][0]+f[n][m][1]+f[n][m][2]+f[n][m][3])%M;
}


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

int main()
{
    string s;
    cin>>s;
    int n=s.size();
    int count=0;
    int x=0;
    for(int i=0;i<n;i++){
        if(s.at(i)=='A'||s.at(i)=='C'||s.at(i)=='G'||s.at(i)=='T'){
            count++;
            x=max(count,x);
        }
        else{
            count=0;
        }
    }    
    cout<<x<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>
//#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using pil = std::pair<int, long long>;
using pli = std::pair<long long, int>;
using plpii = std::pair<long long, std::pair<int, int>>;
using pdd = std::pair<double, double>;
using pis = std::pair<int, std::string>;

const long long INF = 1000000000000000001;
const long long _MOD = 1000000007;
const long long MOD = 998244353;
const int ALPHABET = 27;
const double pi = 3.14159265358979;

using namespace std;
//namespace mp = boost::multiprecision;

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

	string s, t;
	cin >> s >> t;

	int ans = _MOD;
	rep(i, s.length() - t.length() + 1) {
		int sum = 0;
		rep(j, t.length()) {
			if (s[j+i] != t[j]) ++sum;
		}

		ans = min(ans, sum);
	}

	cout << ans << "\n";

	return 0;
}


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

int main(){
    int n,m; cin>>n>>m;
    bool flag = true;
    float sum=0;
    vector<int> v(n);
    for(int i=0; i<n; i++){
        cin>>v[i];
        sum+=v[i];
    }
    float x=4*m;
    float op = 1/x;
    sort(v.rbegin(), v.rend());

    for(int i=0; i<m; i++){
        if(v[i] < sum*op){
            flag=false;
            break;
        }
    }
    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

int N;
std::vector<int> d;

int main()
{
	in>>N;
	d.resize(N);
	rep(i,N)in>>d[i];

	std::sort(d.begin(),d.end());
	d.erase(std::unique(d.begin(),d.end()),d.end());

	out<<d.size()<<std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
const double eps = 1e-6;

double max_r(const vector<int> &xs, const vector<int> &ys, double x, double y){
    double r_max = 0;
    for(int i=0;i<xs.size();i++){
        r_max = max(r_max, hypot(x - xs[i], y - ys[i]));
    }
    return r_max;
}

double min_circle_r(const vector<int> &xs, const vector<int> &ys, double x){
    double lo = -1000, hi = 1000;
    for(int i=0;i<70;i++){
        double side = (hi - lo) / 3;
        double a = lo + side;
        double b = hi - side;
    
        double fa = max_r(xs, ys, x, a);
        double fb = max_r(xs, ys, x, b);
        
        if(fa < fb){
            hi = b;
        } else {
            lo = a;
        }
    }
    
    return max_r(xs, ys, x, lo);
}

double min_circle_r(const vector<int> &xs, const vector<int> &ys){
    double lo = -1000, hi = 1000;
    for(int i=0;i<70;i++){
        double side = (hi - lo) / 3;
        double a = lo + side;
        double b = hi - side;
    
        double fa = min_circle_r(xs, ys, a);
        double fb = min_circle_r(xs, ys, b);
        
        if(fa < fb){
            hi = b;
        } else {
            lo = a;
        }
    }
    
    return min_circle_r(xs, ys, lo);
}


int n, m;
int r[111];

double R[111];
bool used[111];

bool greedy_check(int s){
    vector<int> rs;
    for(int i=0;i<n;i++)if(!used[i]){
        rs.push_back(r[i]);
    }
    
    vector<double> Rs;
    for(int i=s;i<m;i++){
        Rs.push_back(R[i]);
    }
    
    sort(rs.begin(), rs.end());
    sort(Rs.begin(), Rs.end());
    
    int last = -1;
    for(int i=0;i<Rs.size();i++){
        bool found = false;
        for(int j=last+1;j<rs.size();j++){
            if(Rs[i] < rs[j] + eps){
                found = true;
                last = j;
                break;
            }
        }
        if(!found)return false;
    }
    
    return true;
}


int main(){
    cin >> n >> m;
    for(int i=0;i<n;i++)cin >> r[i];

    for(int i=0;i<m;i++){
        int p;
        cin >> p;
        
        vector<int> xs(p), ys(p);
        for(int j=0;j<p;j++){
            cin >> xs[j] >> ys[j];
        }
        
        R[i] = min_circle_r(xs, ys);
    }
    
    vector<int> res(m);
    for(int i=0;i<m;i++){
        bool found = false;
        for(int j=0;j<n;j++)if(!used[j] && R[i] < r[j] + eps){
            used[j] = true;
            if(greedy_check(i + 1)){
                res[i] = j;
                found = true;
                break;
            }
            used[j] = false;
        }
        if(!found){
            cout << "NG" << endl;
            return 0;
        }
    }
    
    for(int i=0;i<m;i++)cout << res[i] + 1 << endl;
    
    return 0;
}

Measured memory_bytes: 1236
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#include <cmath>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

void solve() {
  long S;
  cin >> S;

  long foo = sqrt(S);
  while (foo * foo < S) foo++;

  long ad = foo * foo;

  long bc = ad - S;

  if (bc == 0) {
    cout << 0 << " " << 0 << " " <<
            foo << " " << 0 << " " <<
            0 << " " << foo << endl;
    return;
  }

  map<long, long> mp;
  long tmp = bc;
  while (tmp % 2 == 0) {
    mp[2]++;
    tmp /= 2;
  }
  for (long i = 3; tmp != 1; i+= 2) {
    while (tmp % i == 0) {
      mp[i]++;
      tmp /= i;
    }
  }
  long b = 1;
  long c = 1;

  for (auto it: mp) {
    for (long i = 0; i < it.second; i++) {
      if (b < c) b *= it.first;
      else c *= it.first;
    }
  }

  cout << 0 << " " << 0 << " " <<
          foo << " " << b << " " <<
          c << " " << foo << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	long long a,b,c;
  cin >> a >> b >> c;
  if ((c-a-b)*(c-a-b)-4*a*b>0 && c-a-b>0){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fin ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define w(t) while(t--)
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
#define ff(x) cerr << #x << " is " << x << '\n'
#define FL freopen("in", "r", stdin),freopen("out", "w", stdout);
#define time cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
using namespace std;
typedef unsigned long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;
const int N = 2 * 1e5 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
const double E = 1e-9;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b) 
map<int, int> mG, mV;
vi G[N];
int v[N], vis[N];
void dfs(int u){
    vis[u] = 1;
    mG[u]++;
    mV[v[u]]++;
    for(auto v : G[u])
        if(vis[v] == -1)
            dfs(v);
}
int main(){
    //FL;
    fin;
    int n, m;
    cin >> n >> m;
    fore(i, 1, n + 1)cin >> v[i];
    w(m){
        int x, y;
        cin >> x >> y;
        G[x].pb(y);
        G[y].pb(x);
    }
    cls(vis, -1);
    int ans = 0;
    fore(i, 1, n + 1){
        if(vis[i] == -1){
            mG.clear();
            mV.clear();
            dfs(i);
            int cur = 0;
            fori(i, mG){
                if(mV.count(i->F))
                    cur++;
            }
            ans += cur;
        }
    }
    cout << ans << '\n';
    time;
    return 0;
}   

Measured memory_bytes: 23680
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const int N=5e5+1;
const int INF=1e9;
int l[105];
int main(){
    int n,x;
    cin>>n>>x;
    for(int i=2;i<=n+1;i++){
        cin>>l[i];
    }
    int d=0,i;
    for(i=2;i<=n+1;i++){
        d+=l[i];
        if(d>x){
            cout<<i-1<<endl;
            return 0;
        }
        if(d==x){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<n+1<<endl;
    return 0;
}


Measured memory_bytes: 256
function Main(input) {
  var nums = input.split('\n');

  var num = Math.floor(nums[0]);
  var str = nums[1];
  
  var ans = 0;
  
  for (var i = 0; i < num - 2; i++) {
    if (str[i] === 'A') {
      if (str[i + 1] === 'B') {
        if (str[i + 2] === 'C') {
          ans++;
        }
      }
    }
  }
  
  console.log(ans);
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
import sys

num = raw_input().strip().split()
add = 0
minus = 0
mul = 1
cnt = 1

for n in num:
    add += int(n)
    mul *= int(n)
    if cnt == 1:
        minus = int(n)
        cnt = 0
    else:
        minus -= int(n)

print(str(max(add, minus, mul)))

Measured memory_bytes: 2568
#include <iostream>

using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main()
{
    ll a,b;
    cin>>a>>b;
    if(a>b)swap(a,b);
    if(b-a>1){
        cout<<0;
    }
    else if(a==b){
        ll s=1;
        for(ll i= a;i>=1;i--){s=s*i;s%=MOD;}
        for(ll i= a;i>=1;i--){s=s*i;s%=MOD;}
        cout<<(2*s)%MOD;
    }
    else{
        ll s=1;
        for(ll i= a;i>=1;i--){s=s*i;s%=MOD;}
        for(ll i= b;i>=1;i--){s=s*i;s%=MOD;}
        cout<<s%MOD;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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



Measured memory_bytes: 36128
#include<iostream>
#include<vector>
#include<map>
using namespace std;

int load[200000],train[200000];
int find(int x,int *box){
	if(box[x]==x) return x;
	return box[x]=find(box[x],box);
}
void unite(int x,int y,int* box){
	int rx=find(x,box);
	int ry=find(y,box);
	if(rx==ry) return;
	box[rx]=ry;
}

int main(){
	int n,k,l;
	cin >> n >> k >> l;
	for(int i=0;i<n;i++){
		load[i]=i;
		train[i]=i;
	}
	for(int i=0;i<k;i++){
		int p,q;
		cin >> p >> q;
		unite(p-1,q-1,load);
	}
	for(int i=0;i<l;i++){
		int r,s;
		cin >> r >> s;
		unite(r-1,s-1,train);
	}
	
	vector<pair<int,int>> v(n);
	map<pair<int,int>,int> m;
	for(int i=0;i<n;i++){
		v[i]=make_pair(find(i,load),find(i,train));
		m[v[i]]++;
	}
	for(pair<int,int> w:v) cout << m[w] << " ";
	cout << endl;
	return 0;
}


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

int main() {
  int h, w, a, b;
  cin >> h >> w >> a >> b;
  
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(i < b){
        if(j < a) cout << 1;
        else cout << 0;
      }
      else{
        if(j < a) cout << 0;
        else cout << 1;
      }
    }
    cout << endl;
  }
}

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



#define INF (int)1e9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define endl "\n"

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef map<int, int> mii;

void solve(ll test_case)
{
  int n;
  cin>>n;
  int count=0;
  while(n--){
    int a,b;
    cin>>a>>b;
    if(a==b){
        count++;
    }
    else{
        count=0;
    }
    if(count == 3){
        cout<<"Yes";
        return;
    }
  }
  cout<<"No";
}

int main()
{

//#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
//#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1, t1 = 0;
   // cin >> t;
    while (t1 < t)
    {
        solve(t1 + 1);
        t1++;
    }
 return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,A,B,L;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const ll MOD = 998244353;

int main(){
    cin>>N;
    bool yes = true;
    ll last = 0;
    rep(i,N){
        cin>>A;
        if(A == i+1) continue;
        if(last == 0){
            last = A;
            continue;
        }else if(last != 100){
            if(last != i+1) yes = false;
            last = 100;
        }else{
            yes = false;
        }
    }
    cout<<(yes ? "YES" : "NO")<<endl;
}


Measured memory_bytes: 256