akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
    char c[6];
    scanf("%c%c%c%c%c%c", &c[0], &c[1], &c[2], &c[3], &c[4], &c[5]);
    if(c[4]==c[5]&&c[2]==c[3]) printf("Yes");
    else printf("No");
    return 0;
}

Measured memory_bytes: 256
S = int(input())

A = [1,1,1]

for i in range(3, S - 3 + 1):
  A.append(A[i - 1] + A[i - 3])

if S == 1 or S == 2:
  print(0)
else:
  print(A[S - 3] % (10 ** 9 + 7))

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

int main() {
	// your code goes here
	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin>>n;
	
	int arr[n];
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	
	int t[3],sum=0;
	for(int i=1;i<n-1;i++)
	{
		t[0]=arr[i-1];
		t[1]=arr[i];
		t[2]=arr[i+1];
		
		sort(t,t+3);
		
		if(t[1]==arr[i])
		{
			sum++;
		}
	}
	cout <<sum<<endl;
	
	
	return 0;
}

Measured memory_bytes: 256
def readlines():
    for _ in range(3):
        yield list(map(int, input().split()))

c = list(readlines())

a1 = 0
b1 = c[0][0] - a1
b2 = c[0][1] - a1
b3 = c[0][2] - a1
a2 = c[1][0] - b1
a3 = c[2][0] - b1
ok = (c[1][1] == a2 + b2 and c[1][2] == a2 + b3 and
      c[2][1] == a3 + b2 and c[2][2] == a3 + b3)

print("Yes" if ok else "No")


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

using namespace std;

int main()
{
    using ll = long long;
    using ld = long double;
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll a; ld b;
    cin >> a >> b;

    ll c = (b+0.001)*100;

    cout << a*c/100LL;

    return 0;
} 

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

int main()
{
    int n;
    cin >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    bool flag = true;

    rep(i, n)
    {
        if (v[i] % 2 == 0)
        {
            if (v[i] % 3 != 0 && v[i] % 5 != 0)
            {
                flag = false;
            }
        }
    }

    string ans = flag ? "APPROVED" : "DENIED";
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define SIZE10 100000

typedef long long int ll;
typedef unsigned char u8;



int main(void){
    int N = 0;
    int K = 0;
    int h[SIZE10];
    int ans = 0;
    int i = 0, j = 0;

    scanf("%d %d", &N, &K);
    for(i = 0; i < N; i++){
        scanf("%d", &h[i]);
    }

    for(i = 0; i < N; i++){
        if(h[i] >= K){
            ans++;
        }
    }

    printf("%d", ans);

    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <queue>
#include <iomanip>
#include <map>
#include <bitset>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define INF 1200000000
#define LLINF 1100000000000000000
#define MOD 1000000007
#define FI first
#define SE second
#define MP make_pair

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main()
{
  int A, B, C;
  cin >> A >> B >> C;
  if (A + B >= C) cout << (B + C) << endl;
  else cout << (A + 2*B + 1) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


int main() {
    vector<int> A(5);
    int mn = 9;
    int idx = 0;
    for(int i=0; i<5; i++){
        cin >> A[i];
        if(A[i]%10 >= 1 && A[i]%10<mn){
            mn = A[i]%10;
            idx = i;
        }
    }
    
    int ans = 0;
    for(int i=0; i<5; i++){
        if(i==idx) ans += A[i];
        else ans += (A[i] + 9)/10 * 10;
    }
    
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace test
{
    class MainClass
    {
        public static void Main(string[] args)
        {

            //問題167


            string[] line = Console.ReadLine().Split(' ');

            int N = int.Parse(line[0]);
            int K = int.Parse(line[1]);

            string[] lines = Console.ReadLine().Split(' ');

            int[] A = new int[N];

            //Console.WriteLine("aa");


            for (int i = 0; i < N; i++)
            {
                A[i] = int.Parse(lines[i]);
                //Console.WriteLine(A[i]);

            }




            for (int i = K; i < N; i++)
            {
                //Console.WriteLine("bb");

                //int count = 1;


                //for (int j = i; j > i - K; j--)
                //{
                //    count *= A[j];

                //    //Console.WriteLine(A[j]);
                //}


                //if (count > maecount)  
                //{
                //    Console.WriteLine("Yes");
                //}
                //else
                //{
                //    Console.WriteLine("No");
                //}

                //maecount = count;

                if (A[i] > A[i - K])
                {
                    Console.WriteLine("Yes");
                }
                else
                {
                    Console.WriteLine("No");
                }

            }




        }


    }
}


Measured memory_bytes: 45584
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int cnt = 0;
  for(int i = 0; i < n; i++){
      int ind = i;
      cnt++;
     while(ind < n && s[ind] == s[ind+1]) ind++;
     //cout << ind << endl;
     i = ind;
  }
  cout << cnt;
}



Measured memory_bytes: 512
#include<bits/stdc++.h>
typedef long long ll;
#define MOD (long long)(1e9+7)
using namespace std;

ll n,k,vis[5005];
ll p[5005],c[5005],sum[5005],ans=-1e18;
int main(){
    cin >> n >> k;
    for(int i=1; i<=n; i++) cin >> p[i];
    for(int i=1; i<=n; i++) cin >> c[i];
    for(int i=1; i<=n; i++){
        ll s=c[i];
        vector<ll> t; t.push_back(s);
        for(int j=p[i]; j!=i; j=p[j]) s+=c[j],t.push_back(s);
        int len=t.size();
        for(int j=0; j<len; j++){
            ll rest=k-j-1;
            if(rest<0) break;
            ans=max(ans,t[j]+(rest/len)*max(s,0LL));
        }
    }
    cout << ans;
}


Measured memory_bytes: 3804
#include<bits/stdc++.h>
#define ll  long long int
using namespace std;
int ans[3000][3000];
ll foo(ll a[],int i,int j)
{
	cout<<i<<" "<<j<<endl;
	if(j==(i+1)) return max(a[i],a[j]);
	if(i==j) return a[i];
	if(ans[i][j] !=(-1)) return ans[i][j];

	ans[i][j] = max(a[i]+ min(foo(a,i+1,j-1),foo(a,i+2,j)) , a[j] + min(foo(a,i,j-2),foo(a,i+1,j-1)));
	//cout<<i<<" "<<j<<" "<<ans[i][j]<<endl;
	return ans[i][j];
}
int  main()
{
	memset(ans,(-1),sizeof(ans));
	ll n;
	cin>>n;
	ll a[n],sum=0;
	ll dpX[n][n],dpY[n][n];
	for(ll i=0;i<n;i++) 
	{
		cin>>a[i];
		dpX[i][i] = a[i];
		dpY[i][i] = -a[i];
	}

	for(int l=2;l<=n;l++)
	{
		for(int i=0;i+l<=n;i++)
		{
			int j= i+l-1;
			if(j<n)
			{
				dpX[i][j] = max(dpY[i][j-1]+a[j] , a[i]+ dpY[i+1][j]);
				dpY[i][j] = min(dpX[i][j-1]-a[j],dpX[i+1][j]-a[i]);
			}
		}
	}

	cout<<dpX[0][n-1]<<endl;
}

Measured memory_bytes: 175872
#include <stdio.h>

#define N 500000

void Merge(int A[],int l,int m,int r);
void MergeS(int A[],int l,int r);

int A[N],count=0;
main(){
  int n,i,m,l,r;
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%d",&A[i]);
  }
  MergeS(A,0,n);
  for(i = 0; i < n-1; i++){
    printf("%d ",A[i]);
  }
  printf("%d\n",A[n-1]);
  printf("%d\n",count);
  return 0;
}

void MergeS(int A[],int l,int r){
  int m;
  if(l + 1 < r){
    m = (l + r)/2;
    MergeS(A,l,m);
    MergeS(A,m,r);
    Merge(A,l,m,r);
  }
}
void Merge(int A[],int l,int m,int r){
  int n1=m-l,n2=r-m,i,j,k;
  int L[n1],R[n2];
  for(i = 0; i < n1; i++){
    L[i] = A[l+i];
  }
  for(i = 0; i < n2; i++){
    R[i] = A[m+i];
  }
  L[n1] = 1000000000;
  R[n2] = 1000000000;
  i = 0;
  j = 0;
  for(k = l; k < r; k++){
    if(L[i] <= R[j]){
      A[k] = L[i];
      i++;
      count++;
    }else{
      A[k] = R[j];
      j++;
      count++;
    }
  }
}

Measured memory_bytes: 4500
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        string s;
        cin >> s;
        int _0 = 0, _1 = 0;

        for (auto e : s) {
            if (e == '0') _0++;
            else _1++;
        }

        int ans = min(_0, _1) * 2;
        cout << ans << endl;

    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 512
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

dishes = []
n = getN()
for i in range(n):
    dishes.append(getMN())

dishes.sort(key=lambda x: -(x[0] + x[1]))
#print(dishes)
ans = 0
for i, d in enumerate(dishes):
    if i % 2 == 0:
        ans += d[0]
    else:
        ans -= d[1]

print(ans)


Measured memory_bytes: 21332
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever for (;;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> std::istream &operator>>(std::istream &is, std::pair<A, B> &p) { is >> p.first; is >> p.second; return is; }
using namespace std;
// clang-format on

template<typename T> class LazySegTree_RSQ_RAQ {
  int size = 1;
  std::vector<T> tree, lazy; // 1-indexed

  void flush(int i, int l, int r) {
    tree[i] = tree[i] + lazy[i] * (r - l);
    if (i < size) {
      lazy[i * 2] = lazy[i * 2] + lazy[i];
      lazy[i * 2 + 1] = lazy[i * 2 + 1] + lazy[i];
    }
    lazy[i] = 0;
  }

public:
  LazySegTree_RSQ_RAQ(const int &n) {
    while (size < n) size *= 2;
    tree.assign(size * 2, 0);
    lazy.assign(size * 2, 0);
  }

  // [l, r)
  void add(int l, int r, const int &x) { add(l, r, x, 1, 0, size); }
  void add(const int l, const int r, const int &x, int i, int a, int b) {
    flush(i, a, b);
    if (b <= l || r <= a) return;
    if (l <= a && b <= r) {
      lazy[i] = lazy[i] + x;
      flush(i, a, b);
      return;
    }
    add(l, r, x, i * 2, a, (a + b) / 2);
    add(l, r, x, i * 2 + 1, (a + b) / 2, b);
    tree[i] = tree[i * 2] + tree[i * 2 + 1];
  }

  // [l, r)
  T sum(int l, int r) { return sum(l, r, 1, 0, size); }
  T sum(int l, int r, int i, int a, int b) {
    flush(i, a, b);
    if (b <= l || r <= a) return 0;
    if (l <= a && b <= r) return tree[i];
    T lhs = sum(l, r, i * 2, a, (a + b) / 2);
    T rhs = sum(l, r, i * 2 + 1, (a + b) / 2, b);
    tree[i] = tree[i * 2] + tree[i * 2 + 1];
    return lhs + rhs;
  }
};

main {
  int n, q;
  cin >> n >> q;
  LazySegTree_RSQ_RAQ<int> lst(n);
  while (q--) {
    int a, s, t;
    cin >> a;
    if (a) {
      int i;
      cin >> i;
      --i;
      cout << lst.sum(i, i + 1) << endl;
    } else {
      int s, t, x;
      cin >> s >> t >> x;
      --s, --t;
      lst.add(s, t + 1, x);
    }
  }
}

Measured memory_bytes: 7080
import java.util.*;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

public class Main {
	static PrintWriter out;
	static StringBuilder sb;
	static int mod = 1000000007;
	static long inf = (long) 1e14;
	static int n, q;
	static ArrayList<Integer>[] ad;
	static long[][] memo;
	static boolean f;
	static boolean vis[];
	static int[] size, pa;
	static double[] x, y;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		out = new PrintWriter(System.out);
		int n = sc.nextInt();
		long x = (modPow(10, n) - 2 * modPow(9, n) + modPow(8, n)) % mod;
		x += mod;
		x %= mod;
		System.out.println(x);
		out.close();
	}

	static long modPow(long a, long e)

	{
		long res = 1;
		while (e > 0) {
			if ((e & 1) == 1)
				res = (res * a) % mod;
			a = (a * a) % mod;
			e >>= 1;
		}
		return res;
	}

	static int[] si;
	static ArrayList<Integer> primes;

	static void seive(int N) {
		si = new int[N];
		primes = new ArrayList<>();
		si[1] = 1;
		for (int i = 2; i < N; i++) {
			if (si[i] == 0) {
				si[i] = i;
				primes.add(i);
			}
			for (int j = 0; j < primes.size() && primes.get(j) <= si[i] && (i * primes.get(j)) < N; j++)
				si[primes.get(j) * i] = primes.get(j);
		}
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

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

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

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

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

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

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

		public int[] nextArrInt(int n) throws IOException {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextArrLong(int n) throws IOException {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

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

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

Measured memory_bytes: 25424
#include <bits/stdc++.h>
using namespace std;
int main() {
    int A, B;
    cin >> A >> B;
    int ans = 0;
    for(int i = 0; i <= 1; i++) {
        int &b = (A > B ? A : B);
        ans += b;
        b--;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M=1e9+7;
ll qpow(ll a,ll b){
	ll res = 1;
	while(b){
		if(b & 1) res = (res*a) % M;
		a = (a*a) % M;
		b >>= 1;
	}
	return res % M;
}
ll inv(ll a){
	return qpow(a,M-2);
}
void C(int r,int n){
	if(r>n-r) r=n-r;
	ll a1=1,a2=1;
	for(int i=0;i<r;i++){
		a1=a1*(n-i)%M;
		a2=a2*(i+1)%M;
	}
	cout << a1*inv(a2)%M << endl;
}
int main(){
	ll a,b;
	cin >> a >> b;
	if((a+b)%3!=0)
	cout << 0 << endl;
	else{
		ll x=a-((a+b)/3),y=b-((a+b)/3);
		if(x<0||y<0){
			cout << 0 << endl;
		}
		else{
			C(x,x+y);
		}
	}
	return 0;
}

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

int judge(int* cards, int ncards)
{
  int nsets = ncards / 3;
  if((ncards == 0) || (ncards % 3 != 0)){
    return 0;
  }else{
    do{
      int jdg = 0;
      for(int k=0; k<nsets; k++){
        int ind = 3*k;
        if( ((cards[ind] == cards[ind+1])
          && (cards[ind+1] == cards[ind+2])) ||
            (((cards[ind+1] - cards[ind]) == 1)
            && ((cards[ind+2] - cards[ind+1]) == 1)) ){
              jdg++;
            }
      }
      if(jdg / nsets == 1){
        return jdg;
      }
    }while(next_permutation(cards, cards+ncards));
  }
  return 0;
}

int main()
{
  int n;
  cin >> n;
  int cardsR[9];
  int cardsG[9];
  int cardsB[9];
  int cards[9];
  for(int i=1; i<=n; i++){
    int ncardsR = 0;
    int ncardsG = 0;
    int ncardsB = 0;

    /* input */
    for(int k=0; k<9; k++){
      cin >> cards[k];
    }
    for(int k=0; k<9; k++){
      char col;
      cin >> col;
      switch (col) {
        case 'R': cardsR[ncardsR++] = cards[k]; break;
        case 'G': cardsG[ncardsG++] = cards[k]; break;
        case 'B': cardsB[ncardsB++] = cards[k]; break;
      }
    }

    /* sort */
    sort(&cardsR[0], &cardsR[ncardsR]);
    sort(&cardsG[0], &cardsG[ncardsG]);
    sort(&cardsB[0], &cardsB[ncardsB]);

    /* judge */
    int jdg = 0;
    jdg += judge(cardsR, ncardsR);
    jdg += judge(cardsG, ncardsG);
    jdg += judge(cardsB, ncardsB);


    cout << jdg / 3 << endl;
  }
}

Measured memory_bytes: 3076
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int H,W;
ll arr[1001][1001];
#define M int(1e9+7)
main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>H>>W;
	for(int i=0;i<H;i++)
	{
		string ss;
		cin>>ss;
		for(int j=0;j<W;j++)
		{
			if(ss[j]=='.')
				arr[i][j]=1;
		}
	}
	for(int i=H-1;i>=0;i--)
	{
		for(int j=W-1;j>=0;j--)
		{
			if((i==H-1&&j==W-1)||arr[i][j]==0)
				continue;
			arr[i][j]=(arr[i][j+1]+arr[i+1][j])%M;
		}
	}
	cout<<arr[0][0];
}


Measured memory_bytes: 8064
package main

import (
	"fmt"
)

func main() {
	var n, d int
	fmt.Scan(&n, &d)

	treePerWatcher := 2*d + 1
	if n%treePerWatcher == 0 {
		fmt.Println(n / treePerWatcher)
	} else {
		fmt.Println(n/treePerWatcher + 1)
	}
}


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

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

const int INF = 1e9;
const int mod = 1e9+7;

int main()
{
    int n,k;
    cin >> n >> k;
    vector<int> h(n);
    for(int i = 0; i < n; i++) cin >> h[i];
    sort(h.begin(),h.end());
    int ans = INF;
    for(int i = 0; i <= n - k; i++){
        ans = min(ans,h[i+k-1]-h[i]);
    }
    cout << ans << endl;
    return 0;
}

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

bool check[200010];

int main() {
  int n,m;
  cin>>n>>m;
  int a,b;
  bool flag=false;
  for (int i=0; i<m; i++) {
    scanf("%d %d",&a,&b);
    if (a==1) {
      if (check[b]==true)
	flag=true;
      else
	check[b]=true;
    }
    if (b==n) {
      if (check[a]==true)
	flag=true;
      else
	check[a]=true;
    }
  }

  if (flag)
    cout<<"POSSIBLE"<<endl;
  else
    cout<<"IMPOSSIBLE"<<endl;
  return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
char s[5][5];
int main(){
    int i,j;
    scanf("%s",s[0]);
    scanf("%s",s[1]);
    if(s[0][0]==s[1][2]&&s[0][1]==s[1][1]&&s[0][2]==s[1][0])
        printf("YES\n");
    else printf("NO\n");
}


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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Mll = M<ll, ll>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin(),ie=(c).rend();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

struct UFTree {
    static const int MAX_N = 1e6;
    int p[MAX_N], r[MAX_N], s[MAX_N];

    UFTree(int n): p(), r(), s() {
        for(int i = 0; i < n; ++i) {
            p[i] = i;
            r[i] = 0;
            s[i] = 1;
        }
    }

    int root(int x) {
        return p[x] == x ? x : (p[x] = root(p[x]));
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }

    void unite(int x, int y) {
        x = root(x);
        y = root(y);
        if(x == y) return;

        if(r[x] < r[y]) {
            p[x] = y;
            s[y] = s[x] + s[y];
        } else {
            p[y] = x;
            s[x] = s[x] + s[y];
            if(r[x] == r[y]) r[x]++;
        }
    }

    int size(int x) {
        return s[root(x)];
    }
};

ll n, a, b;

int main() {
    cin >> n >> a >> b;
    Vl h(n);
    REP(i, n) cin >> h[i];

    ll add = a-b;
    ll left = 0, right = 1e9;
    while (right - left > 1) {
        ll mid = (left + right) / 2;

        ll cnt = 0;
        Vl x(h);
        REP(i, n) {
            x[i] -= mid * b;
            cnt += (max(x[i], 0LL) + add-1) / add;
        }
        if (cnt <= mid) {
            right = mid;
        } else {
            left = mid;
        }
    }
    cout << right << '\n';

    return 0;
}


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    int H, W, D;
    cin >> H >> W >> D;
    vector<vector<int>> A(H, vector<int>(W));
    for (int i=0; i<H; ++i) {
        for (int j=0; j<W; ++j) {
            cin >> A[i][j];
        }
    }
    int Q;
    cin >> Q;
    vector<pair<int, int>> lr(Q);
    for (int i=0; i<Q; ++i) cin >> lr[i].first >> lr[i].second;

    vector<pair<int, int>> rev(H*W+1);
    for (int i=0; i<H; ++i) {
        for (int j=0; j<W; ++j) {
            rev[A[i][j]] = make_pair(i, j);
        }
    }
    vector<ll> sum(H*W+1);
    for (int i=1; i<H*W+1; ++i) {
        if (i > D) {
            int pi = rev[i-D].first, pj = rev[i-D].second;
            int ci = rev[i].first, cj = rev[i].second;
            sum[i] = sum[i-D] + abs(pi - ci) + abs(pj - cj);
        }
    }
    for (auto p : lr) cout << sum[p.second] - sum[p.first] << endl;
}

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

    solve();

    return 0;
}


Measured memory_bytes: 5828
n, m = gets.chomp.split(" ").map(&:to_i)
mod = 1000000007
big = n > m ? n : m
small =  n > m ? m : n
if big-1 > small 
    puts 0
    exit
end

dog = 1
monkey = 1
(1..n).each do |i|
    dog *= i
    dog %= mod
end
(1..m).each do |i|
    monkey *= i
    monkey %= mod
end

if n == m then
    dog = dog * 2 % mod
    puts (dog * monkey) % mod
else
    puts (dog * monkey) % mod
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (1E9+7)
#define PI 3.1415926535897932384

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
	string s;
	for (int i = 0; i<tgt.size(); i++) {
		s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
	}
	out << s;
	return out;
}

class CompareDist
{
public:
	bool operator()(pair<int, int> n1, pair<int, int> n2) {
		return n1.fs<n2.fs;
	}
};

int main() {
	int n, in, inn;
	ll sum, k;
	cin >> n >> k;
	vector<pii> vp;
	rep(i, n) {
		cin >> in >> inn;
		vp.push_back({ in,inn });
	}
	sort(all(vp), CompareDist());
	rep(i, n) {
		sum += vp[i].sc;
		if (sum >= k) {
			cout << vp[i].fs << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N ; i++) {
        std::cin >> A.at(i);
    }
    double po = 0;
    for (int j = 0; j < N; j++)
    {
        po = po + 1/double(A[j]) ;
    }
    
    cout << 1/po;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <algorithm>
#include <typeinfo>
#define _USE_MATH_DEFINES
#include <cmath>

using namespace std;

int main(){

    int n;
    cin >> n;

    vector<int> data(n);
    for(int i=0; i<n; i++){
        cin >> data[i];
    }

    int swapCount=0;
    for(int i=0; i<n; i++){
        int mini = i;
        for(int j=i; j<n; j++){
            if(data[j]<data[mini]){
                mini = j;
            }
        }
        if(i != mini){
            int tmp = data[mini];
            data[mini] = data[i];
            data[i] = tmp;
            swapCount += 1;
        }
    }

    for(int i=0; i<n; i++){
        if(i==n-1){
            cout << data[i] << endl;
            break;
        }
        cout << data[i] << " ";
    }

    cout << swapCount << endl;

    return 0;
}



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

const int MAXN = 2 * 105000;
const long long INF = 5 * 1e9;

int n, t;
int a[MAXN], b[MAXN];
vector<int> v, vz;
long long dp[MAXN][35];
long long mn[35];
int ans = 0;

long long f(int idx, long long tm) {
    return tm + 1ll * a[idx] * tm + b[idx];
}

bool cmp(const int& a, const int& b) {
    return f(b, f(a, 1) + 1) < f(a, f(b, 1) + 1);
}

int main() {
    scanf("%d %d", &n, &t);
    for (int i = 0; i < n; i++) {
        scanf("%d %d", &a[i], &b[i]);
    }

    for (int i = 0; i < n; i++) {
        if (a[i] != 0) {
            v.push_back(i);
        } else {
            vz.push_back(b[i]);
        }
    }
    sort(v.begin(), v.end(), cmp);
    sort(vz.begin(), vz.end());

    for (int i = 0; i <= 30; i++) {
        mn[i] = INF;
    }
    mn[0] = 0;

    for (int i = 0; i < (int)v.size(); i++) {
        for (int j = 30; j >= 1; j--) {
            dp[i][j] = INF;
            if (mn[j - 1] != INF) {
                long long tm = f(v[i], mn[j - 1] + 1);
                if (tm <= t) {
                    dp[i][j] = tm;
                }
            }
            mn[j] = min(mn[j], dp[i][j]);
        }
    }

    for (int i = 0; i <= 30; i++) {
        if (mn[i] != INF) {
            // cerr << i << " " << mn[i] << endl;
            ans = max(ans, i);
            long long tm = mn[i];
            for (int j = 0; j < (int)vz.size(); j++) {
                tm = tm + 1 + vz[j];
                if (tm <= t) {
                    ans = max(ans, i + j + 1);
                } else {
                    break;
                }
            }
        }
    }
    cout << ans << endl;
}


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

struct Dice {
    int a, b, c, d, e, f;
    void setFaces(int a, int b, int c, int d, int e, int f) {
        this->a = a;
        this->b = b;
        this->c = c;
        this->d = d;
        this->e = e;
        this->f = f;
    }
    void rotate(char dir) {
        switch (dir) {
            case 'N':
                setFaces(b, f, c, d, a, e);
                break;                
            case 'E':
                setFaces(d, b, a, f, e, c);
                break;                
            case 'S':
                setFaces(e, a, c, d, f, b);
                break;                
            case 'W':
                setFaces(c, b, f, a, e, d);
                break;
            case 'L':
                setFaces(a, d, b, e, c, f);
                break;
            case 'R':
                setFaces(a, c, e, b, d, f);
                break;
        }
    }
    void roll(string s) {
        for (int i=0; i<s.size(); i++)
            rotate(s[i]);
    }
    bool equal(Dice dice) {
        if (dice.a == a && dice.b == b && dice.c == c 
            && dice.d == d && dice.e == e && dice.f == f)
            return true;
        else
            return false;
    }
    bool equivalent(Dice dice) {
        string s = "EEEENEEEENEEEENEEEENLEEEELLEEEE";
        for (int i=0; i<s.size(); i++) {
            dice.rotate(s[i]);
            if (equal(dice))
                return true;
        }
        return false;
    }
};

int main() {
    int n, a, b, c, d, e, f;
    Dice dice[100];

    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> a >> b >> c >> d >> e >> f;
        dice[i].setFaces(a, b, c, d, e, f);
    }

    bool flag = true;
    for (int i=0; i<n; i++)
        for (int j=i+1; j<n; j++)
            if (dice[i].equivalent(dice[j]))
                flag = false;

    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}



Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 1e5
#define INF 1<<30
constexpr ll mod = 1e9 + 7;
using namespace std;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

int main() {
	cin >> N >> A >> B >> C >> D;
	A--, B--, C--, D--;
	cin >> S;
	vector<int> a(N, 0);
	for (int i = 1; i < N-1; i++) {
		if (S[i] == '#') {
			if (S[i + 1] == '#') {
				a[i] = 1;
			}
		}
		else {
			if (S[i - 1] == '.'&&S[i + 1] == '.') {
				a[i] = 2;
			}
		}
	}
	bool flag = 1;
	for (int i = A; i < max(C,D); i++) {
		if (a[i] == 1) {
			flag = 0;
		}
	}
	if (D < C&&flag==1) {
		flag = 0;
		for (int i = B; i <= D; i++) {
			if (a[i] == 2) {
				flag = 1;
			}
		}
	}
	if (flag)cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 1284
#include <iostream>

using namespace std;

int main()
{
    int n, c, num;
    cin >> n;
    c = 0;
    for ( int i = 1; i <= n; i = i+2) {
        cin >> num;
        if ( num % 2 == 1) c++;
        if ( i != n) cin >> num;
    }
    cout << c;
}

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

int main() {
    int n; cin >> n;
    vector <int> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    int ans = 0;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            ans = max(ans, a[i] - a[j]);
    cout << ans << endl;
}

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

ll k;
ll n,t;

int main(){
	cin>>k;
	n=k/50;
	t=k%50;
	cout<<50<<endl;
	for (ll i=0;i<50-t;i++){
		cout<<i+n<<" ";
	}
	for (ll i=50-t+1;i<=50;i++){
		cout<<i+n<<" ";
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

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

int Rank(int x) {
    int rank = 0;
    while(x > 0){
        rank++;
        x = x/10;
    }
    
    return rank;
}


int main(int argc, const char * argv[]) {
    
    
    
    int n; cin >> n;
    
    int ans = 0;
    
    for (int i = 1; i <= n ; i++) {
        if( Rank(i) % 2 == 1 ) ans++;
    }
    
    cout << ans << endl;
    
    
    
    
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <deque>
using namespace std;
 
#define ll long long

long dp[4][4][4][110], mod=1000000007;
int main() {
    int N; cin >> N;
    for(int i=0; i<4; ++i) for(int j=0; j<16; ++j) dp[i][j/4][j%4][2]=1;
    dp[0][1][2][2]=dp[1][0][2][2]=dp[0][2][1][2]=0;
    for(int p=3; p<N; ++p){
        for(int i=0; i<4; ++i){
            for(int j=0; j<16; ++j){
                for(int k=0; k<4; ++k){
                    dp[j/4][j%4][k][p]=(dp[j/4][j%4][k][p]+dp[i][j/4][j%4][p-1])%mod;
                }
                if(i==0 && (j/4==1 || j%4==1)){
                    dp[j/4][j%4][2][p]=(dp[j/4][j%4][2][p]+mod-dp[i][j/4][j%4][p-1])%mod;
                }
            }
        }
        dp[0][1][2][p]=dp[1][0][2][p]=dp[0][2][1][p]=0;
    }
    long ans=0;
    for(int i=0; i<4; ++i){
        for(int j=0; j<16; ++j) ans=(ans+dp[i][j/4][j%4][N-1])%mod;
    }
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
MAX = 50


def resolve():
    n = int(input())

    D = [[0] * MAX for _ in range(MAX)]
    for _ in range(n):
        a = int(round(float(input()) * 10 ** 9))
        t = a
        x = 0
        while t % 2 == 0:
            t //= 2
            x += 1
        t = a
        y = 0
        while t % 5 == 0:
            t //= 5
            y += 1
        D[x][y] += 1

    res = 0
    for x1 in range(MAX):
        for y1 in range(MAX):
            for x2 in range(max(0, 18 - x1), MAX):
                for y2 in range(max(0, 18 - y1), MAX):
                    if x1 == x2 and y1 == y2:
                        res += D[x1][y1] * (D[x1][y1] - 1)
                    else:
                        res += D[x1][y1] * D[x2][y2]
    print(res // 2)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9172
import java.io.BufferedInputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner stdin = new Scanner(new BufferedInputStream(System.in));
		List<String> output = new ArrayList<String>();

		while (stdin.hasNext()) {
			String input = stdin.nextLine();
			String[] inputs = input.split(" ");
			int m = Integer.parseInt(inputs[0]);
			int f = Integer.parseInt(inputs[1]);
			int r = Integer.parseInt(inputs[2]);
			if (m == -1 && f == -1 && r == -1) {
				break;
			} 
			if (m == -1 || f == -1) {
				output.add("F");
			}
			else {
				
				String grade = "";
				int total = m + f;
				if (total >= 80) {
					output.add( "A");
				} else if (total >= 65 && total < 80) {
					output.add("B");
				} else if (total >= 50 && total < 65) {
					output.add("C");
				} else if (total >= 30 && total < 50) {
					if (r >= 50) {
						output.add("C");
					} else {
						output.add("D");
					}
				} else if (total < 30) {
					output.add("F");
				}
			}
		}
		for (String out : output) {
			System.out.println(out);
		}
	}
}

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

#define FasterIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(v) v.begin(), v.end()
const int MOD = 1e9+7;

int main(){
    FasterIO;

    int r;
    
    while(cin>>r){
        cout<<3*r*r<<endl;
    }

    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int n,t,e;
int x[101];
int main(){
  cin >> n >> t >> e;
  for(int i=0;i<n;i++){
    scanf("%d",&x[i]);
  }

  for(int i=0;i<n;i++){
    int m = t%x[i];
    if(m <= e || x[i] - m <= e ){
      cout << i+1 << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}

Measured memory_bytes: 1240
#include <stdio.h>
#include <stdlib.h>

int s[1000];
int top;

void push(x){
  top++;
  s[top]=x;
}

int pop(){
  top--;
  return s[top+1];
}

void ka(){
  int a,b;

  b=pop();
  a=pop();
  push(a+b);
}

void sa(){
  int a,b;

  b=pop();
  a=pop();
  push(a-b);
}

void jo(){
  int a,b;

  b=pop();
  a=pop();
  push(a*b);
}



int main(){
  char str[100];

  while(scanf("%s",str)!=EOF){

    if(str[0]=='+') ka();
    else if(str[0]=='-') sa();
    else if(str[0]=='*') jo();
    else push(atoi(str));
  }

  printf("%d\n",s[1]);

  return 0;
}

Measured memory_bytes: 548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main() {
    ll n, m, q;
    cin >> n >> m >> q;

    vector<vector<ll>> train(n,vector<ll>(n,0));
    vector<vector<ll>> train_sum(n,vector<ll>(n+1,0));


    for(int i = 0; i < m; i++){
        int l, r;
        cin >> l >> r;
        l--; r--;
        train[l][r]++;
    }
    for(int i = 0; i < n; i++){
        for(int j = 1; j < n+1; j++){
            train_sum[i][j] = train_sum[i][j-1] + train[i][j-1];
        }
    }
    for(int i = 0; i < q; i++){
        int l, r;
        cin >> l >> r;
        l--; r--;
        ll ans = 0;
        for(int j = l; j <= r; j++){
            ans += train_sum[j][r+1];
        }
        cout << ans << endl;
    }

    return 0;
}


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

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

    vector<int> S(M + 1);
    vector<int> C(M + 1);
    for(int i = 0; i < M; i++){
        cin >> S.at(i) >> C.at(i);
    }


    for(int i = 0; i < 1000; i++){
        string s = to_string(i);
        if(s.size() != N) continue;
        bool judge = true;
        for(int j = 0; j < M; j++){
            char sx = s.at(S.at(j) - 1);
            if(sx != C.at(j) + '0') judge = false;
        }
        if(judge){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Collections.Generic;

public class Kadai
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        string inp_str = Console.ReadLine();
        string[] inp_arr = inp_str.Split(' ');
        int[] input = new int[n];
        for (int i = 0; i < n; i++)
        {
            input[i] = int.Parse(inp_arr[i]);
        }

        int count = 0;

        for (int i = 0; i < n;i++){
            int minj = i;
            for (int j = i; j < n;j++){
                if(input[j] < input[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                int temp = input[i];
                input[i] = input[minj];
                input[minj] = temp;
                count++;
            }
        }

        for (int k = 0; k < n - 1; k++)
        {
            Console.Write(input[k]);
            Console.Write(' ');
        }
        Console.WriteLine(input[n - 1]);
        Console.WriteLine(count);
    }
}


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

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] a = new int[3];
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < 3; j++) {
				a[j] = scan.nextInt();
			}

			Arrays.sort(a);
			System.out.println(a[2]*a[2]==a[0]*a[0]+a[1]*a[1] ? "YES" : "NO");
		}
	}
}

Measured memory_bytes: 23376
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef long long int lnt;
typedef pair<lnt,lnt> P;
char str[14];

int main()
{
	scanf("%s",str);
	for(int i=0;i<12;i++){
		printf("%c",str[i]);
		if(i==3) cout<<' ';
	}
	printf("\n");
}

Measured memory_bytes: 256
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
#define endl '\n'
#define ld long double
#define all(a) a.begin(),a.end()
#define int long long
#define pb push_back
#define pii pair <int, int>
#define ff first
#define ss second
#define sz(v) (int)v.size() 
#define UB upper_bound
#define LB lower_bound
#define BP(x) __builtin_popcountll(x)
#define PQS priority_queue <int, vector<int>, greater<int> > 
#define OST tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int getRand(int l, int r) {
  uniform_int_distribution<int> uid(l, r);
  return uid(rng);
}

const int INF = 1e18 + 0;
const int mod = 1e9 + 7;
//const int mod = 998244353;

bool ok(int x, int y, int z) {
  if(x == y || x == z || y == z) return 0;
  vector <int> v;
  v.pb(x); v.pb(y); v.pb(z);
  sort(all(v));
  return (v[2] < v[1]+v[0]);
}

void solve() {
  int n; cin >> n;
  int data[n+5];
  for(int i = 1; i <= n; i++) {
    cin >> data[i];
  }

  int ans = 0;
  for(int i = 1; i <= n; i++) {
    for(int j = i+1; j <= n; j++) {
      for(int k = j+1; k <= n; k++) {
        if(ok(data[i], data[j], data[k])) {
          ans++;
        }
      }
    }
  }
  cout << ans << '\n';
}

/*
  * overflow, array bounds
  * do smth instead of nothing and stay organized
*/
signed 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
   int t = 1;  //cin >> t;
   for(int i = 1; i <= t; i++) {
   //  cout << "Case #" << i << ": ";
     solve();
  }
}    

/*

*/

Measured memory_bytes: 3648
#include<bits/stdc++.h>                                                                                               
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long
#define mk_p(a,b)   make_pair((a),(b))
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;

signed main(){
    string s;
    cin >> s;
    int n = s.size(),cnt = 0;
    rep(i,n){
        if(s[i] == 'x') cnt++;
    }   
    if(15 - cnt >= 8) cout << "YES\n";
    else cout << "NO\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=105;

int n;
double v[maxn],t[maxn];
double cur,ans;

int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%lf",&t[i]);
	}
	for(int i=0;i<n;i++){
		scanf("%lf",&v[i]);
	}
	for(int i=0;i<n;i++){
		double inc,kep,dec;
		double lim=100000000.0;
		double tmp=0.0;
		for(int j=i+1;j<=n;j++){
			lim=min(lim,v[j]+tmp);
			tmp+=t[j];
		}
		inc=min(v[i]-cur,(lim+t[i]-cur)*0.5);
        inc=min(inc,t[i]);
        dec=max(0.0,cur+inc-lim);
        kep=t[i]-inc-dec;
        ans+=0.5*(cur*2.0+inc)*inc;
        ans+=(cur+inc)*kep;
        ans+=0.5*((cur+inc)*2.0-dec)*dec;
        cur+=inc;
        cur-=dec;
	}
	printf("%f",ans);
	return 0;
}

Measured memory_bytes: 256
{-# OPTIONS_GHC -O #-}
{-# LANGUAGE BangPatterns #-}

import Control.Monad
import Control.Monad.ST
import Data.List
import qualified Data.ByteString.Char8 as B
import Data.Array.Unboxed
import Data.Array.ST

main=do
  (n:m:q:_)<-map read.words<$>getLine::IO[Int]
  lrs<-replicateM m $ unfoldr(B.readInt.B.dropWhile(==' '))<$>B.getLine::IO[[Int]]
  pqs<-replicateM q $ unfoldr(B.readInt.B.dropWhile(==' '))<$>B.getLine::IO[[Int]]
  --
  let !ar = f n lrs
  putStr.unlines $ map (\(p:q:_)->show $ ar ! (p,q)) pqs
--
f n lrs = runSTUArray $ do
  ar <- newArray ((1,1),(n+1,n)) 0 :: ST s (STUArray s (Int,Int) Int)
  forM_ lrs $ \(l:r:_) -> do
    writeArray ar (1,r) =<< succ <$> readArray ar (1,r)
    writeArray ar (l+1,r) =<< pred <$> readArray ar (l+1,r)
  forM_ [(l,r)|l<-[2..n],r<-[1..n]] $ \(l,r) -> do
    writeArray ar (l,r) =<< (+) <$> readArray ar (l,r) <*> readArray ar (l-1,r)
  forM_ [(l,r)|l<-[1..n],r<-[2..n]] $ \(l,r) -> do
    writeArray ar (l,r) =<< (+) <$> readArray ar (l,r) <*> readArray ar (l,r-1)
  pure ar


Measured memory_bytes: 88700
def lunlun(K,S):
    if len(S) >= K:
        S.sort()
        print(S[K-1])
        return

    for a in range(len(S)):
        i = S[a]
        rem = i%10
        n = 10*i + rem

        if rem == 9:
            S.append(n)
            S.append(n-1)
        elif rem == 0:
            S.append(n)
            S.append(n+1)
        else:
            S.append(n)
            S.append(n+1)
            S.append(n-1)
    lunlun(K,list(set(S)))


K = int(input())
S = [i for i in range(1,10)]

lunlun(K,S)

Measured memory_bytes: 38080
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    Map<String, Integer> map = new TreeMap<>();
    int max = 0;
    for (int i = 0; i < N; i++) {
      String s = sc.next();
      if (map.containsKey(s)) map.put(s, map.get(s) + 1);
      else map.put(s, 1);
      max = Math.max(max, map.get(s));
    }
    sc.close();
    for (String key : map.keySet()) {
      if (map.get(key) == max) System.out.println(key);
    }
  }
}

Measured memory_bytes: 79484
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define PI 3.14159265358979323

//int calc1(float a,float b,float c,float d,float e,float f,float *x,float *y);
//void quick(int *,long long,long long);
//int comp(char *a,char *b);

int main(){
	
	int wa,d,i,n;

	while(scanf("%d",&d)!=EOF){
		n=600/d;
		wa=0;
		for(i=1;i<=n-1;i++)
			wa+=((i*d)*(i*d)*d);
		printf("%d\n",wa);
	}
	//for(i=0;i<=1000000000;i++);
	return 0;
}

Measured memory_bytes: 592
from collections import deque

n, m = map(int, input().split())
check = [0 for _ in range(n)]
edges = [[] for _ in range(n)]

for _ in range(n - 1 + m):
    a, b = map(int, input().split())
    check[b - 1] += 1
    edges[a - 1].append(b - 1)

rood = check.index(0)
queue = deque()
ans = [0 for _ in range(n)]
queue.append(rood)
while queue:
    pos = queue.popleft()
    for n_pos in edges[pos]:
        check[n_pos] -= 1
        if check[n_pos] == 0:
            queue.append(n_pos)
            ans[n_pos] = pos + 1
        
for pos in ans:
    print(pos)

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

int n;

inline void input (int &ret) {
	ret = 0; char ch = getchar ();
	while (!isdigit (ch)) ch = getchar ();
	while (isdigit (ch)) {
		ret = (ret << 1) + (ret << 3) + (ch ^ '0');
		ch = getchar ();
	}
	return;
}

int main () {
	input (n);
	printf ("%d\n", (1000 - n % 1000) % 1000);
	return 0;
}

Measured memory_bytes: 3744