akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N,A,B;cin>>N>>A>>B;
  string S;cin>>S;
  int l=S.size();
  int count=0;
  int ans=0;
  for(int i=0;i<l;i++){
    if(S.at(i)=='a'){
      count++;
      if(count<=A+B) cout<<"Yes"<<endl;
      else{
        cout<<"No"<<endl;
        count--;
      }
    }
    else if(S.at(i)=='b'){
      count++;
      ans++;
      if(count<=A+B && ans<=B) cout<<"Yes"<<endl;
      else{
        cout<<"No"<<endl;
        count--;
        ans--;
      }
    }
    else cout<<"No"<<endl;
  }
}


Measured memory_bytes: 3728
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<map>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
bool cmp_P(const P &a,const P &b){
  return a.second < b.second;
}
int main()
{
  int N;
  string s="";
  cin >> N;
  
  while(N != 0){
    if(N % 2 != 0){
      N--;
      s = "1"+s;
    }else
      s = "0" + s;
    N /= -2;
  }
  if(s == "") s = "0";
  cout << s << endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int y, m, d, w;
	
	char* str[7] = {"Sun", "Mon", "Tues", "Wednes", "Thurs", "Fri", "Satur"};
	
	while(1){
		cin >> m >> d;
		y = 2004;
		if(m == 0){
			break;
		}
		if(m == 1 || m == 2 ){
			y--;
			m += 12;
		}
		w = (y+y/4-y/100+y/400+(13*m+8)/5+d)%7;

		cout << str[w] << "day" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <string.h>

const int N = 1e5 + 10;

int a[N];

int main() {
  memset(a, 0, sizeof(a));
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    int l, r;
    scanf("%d %d", &l, &r);
    l--; r--;
    a[l]++;
    a[r + 1]--;
  }
  for (int i = 0; i < n; i++) {
    a[i] += a[i - 1];
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans += (a[i] == m);
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 512
using System;

namespace relay_b
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            bool flag = true;
            for (int i = 0; i < s.Length; i++)
            {
                switch (s[i])
                {
                    case ('b'):
                        {
                            if (s[s.Length - i - 1] != 'd')
                            {
                                flag = false;
                            }
                            break;
                        }
                    case ('d'):
                        {
                            if (s[s.Length - i - 1] != 'b')
                            {
                                flag = false;
                            }
                            break;
                        }
                    case ('p'):
                        {
                            if (s[s.Length - i - 1] != 'q')
                            {
                                flag = false;
                            }
                            break;
                        }
                    case ('q'):
                        {
                            if (s[s.Length - i - 1] != 'p')
                            {
                                flag = false;
                            }
                            break;
                        }
                    default:
                        {
                            flag = false;
                            break;
                        }
                }
            }
            Console.WriteLine(flag ? "Yes" : "No");
        }
    }
}

Measured memory_bytes: 13116
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll n, k;
  cin >> n >> k;
  vl p(n);
  rep(i, n) cin >> p[i];
  sort(all(p));
  ll ans=0;
  rep(i, k) ans += p[i];
  cout << ans << newl;
  return 0;
}

Measured memory_bytes: 3664
#include <cstdio>
#include <cmath>
#include <vector>
#define pb push_back
using namespace std;
int main(void)
{
	int n,b;
	vector<int> vec;
	while(scanf("%d",&n)!=EOF)
	{
		b=n;
		vec.clear();
		while(b>0)
		{
			vec.pb(b%2);
			b/=2;
		}
		int size = vec.size();
		for(int i=0;i<size;i++)
		{
			if(vec[i])
			{
				printf("%d",(int)(pow(2,i)));
				(i==size-1) ? printf("\n") : printf(" ");
			}
			else
			{
				if(i==size-1)printf("\n");
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1088
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	int h, w;
	cin >> h >> w;
	map<char, int> m;
	rep(i, h){
		string s;
		cin >> s;
		rep(j, s.size()){
			m[s[j]]++;
		}
	}

	int x, y, z, v;
	if(h % 2 == 0){
		x = h/2;
		y = 0;
		v = 0;
	}else{
		x = h/2;
		y = w/2;
		v = 1;
	}
	if(w % 2 == 0){
		x *= (w/2);
		z = 0;
		v = 0;
	}else{
		x *= (w/2);
		z = h/2;
		v *= 1;
	}
	while(x > 0){
		pair<char, int> add(0, 0);
		for(auto p : m){
			if(add.second < p.second) add = p;
		}
		if(add.second < 4){
			cout << "No" << endl;
			return 0;
		}
		x--;
		m[add.first] -= 4;
	}
	while(y > 0){
		pair<char, int> add(0, 0);
		for(auto p : m){
			if(add.second < p.second) add = p;
		}
		if(add.second < 2){
			cout << "No" << endl;
			return 0;
		}
		y--;
		m[add.first] -= 2;
	}
	while(z > 0){
		pair<char, int> add(0, 0);
		for(auto p : m){
			if(add.second < p.second) add = p;
		}
		if(add.second < 2){
			cout << "No" << endl;
			return 0;
		}
		z--;
		m[add.first] -= 2;
	}
	while(v > 0){
		pair<char, int> add(0, 0);
		for(auto p : m){
			if(add.second < p.second) add = p;
		}
		if(add.second < 1){
			cout << "No" << endl;
			return 0;
		}
		v--;
		m[add.first] -= 1;
	}
	cout << "Yes" << endl;
	return 0;
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    char A, B;
    cin >> A >> B;
    if (A == B)
        cout << 'H' << endl;
    else
        cout << 'D' << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    N=list(input())

    s = 0
    for n in N:
        m = int(n)
        s += m
        s %= 9

    print("Yes" if s % 9 == 0 else "No")





if __name__ == "__main__":
    main()

Measured memory_bytes: 77540
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<map>
using namespace std;
#define N 200001
map<int, int> mp;
int n,m,x;
int main(){
    while (scanf("%d %d",&n,&m)!=EOF){
        mp.clear();
        mp[0]=1;
        int sum = 0;
        long long ans = 0;
        for (int i=0;i<n;i++){
            scanf("%d",&x);
            sum = (sum+x)%m;
            ans = ans + mp[sum];
            mp[sum]++;
        }
        printf("%lld\n",ans);
    }
    return 0;
}





Measured memory_bytes: 3200
import sys
import numpy as np
input = sys.stdin.readline

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

AB = []

for i in range(N):
	a,b = map(int, input().split())
	AB.append([a,b])
AB = np.array(AB)
A = AB[:,0]
B = AB[:,1]
dp = np.array([0]*(H+1))
for i in range(1, H+1):
	dp[i] = np.min(dp[np.maximum(i - A, 0)]+B)

print(dp[H])

Measured memory_bytes: 12616
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 50;
deque<int> q;
char s[N];

int main() {
    scanf("%s", s);
    for(int i=0;i<strlen(s);i++) {
        q.push_back(s[i] - 'a');
    }
    int flag = 0;
    int n, type, pos;
    char ch;
    cin>>n;
    for(int i=0;i<n;i++) {
        cin>>type;
        if(type == 1) {
            flag = (flag ^ 1);
        }else {
            cin>>pos>>ch;
            if((flag == 0 && pos == 1)
               || (flag == 1) && pos == 2) {
                q.push_front(ch-'a');
               }else {
                q.push_back(ch-'a');
               }
        }
    }
    if(flag == 0) {
        while(!q.empty()) {
            type = q.front(); q.pop_front();
            printf("%c", type+'a');
        }
    }else {
        while(!q.empty()) {
            type = q.back(); q.pop_back();
            printf("%c", type+'a');
        }

    }

    cout<<endl;
    return 0;
}


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

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i > (n); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1LL << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) ((n) * ((n) + 1)) / 2
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).push_front(a)
#define eb(x, a) (x).emplace_back(a)
#define F first
#define S second
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {  //多次元初期化
  std::fill((T *)array, (T *)(array + N), val);
}
template <class T>
bool chmax(T &a, const T &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

signed main(void) {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int n;
  cin >> n;
  const int MX = 1e18 + 1;
  vector<int> a(n);
  arep(i, a) cin >> i;
  sort(all(a));

  int ans = a[0];
  if (ans == 0) return cout << 0 << '\n', 0;
  rep(i, 1, n) {
    if (MX / ans < a[i]) {
      cout << -1 << '\n';
      return 0;
    }
    ans *= a[i];
  }

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

Measured memory_bytes: 3904
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define int long long
#define mod 1000000007
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
#define N 300005
int a[N];
int b[N];
int qpow(int u,int v)
{
	int ans=1;
	while(v)
	{
		if(v&1) ans=ans*u%mod;
		u=u*u%mod;
		v>>=1;
	}
	return ans;
}
signed main()
{
#ifdef __LOCAL__
	freopen("in.txt","r",stdin);
#endif
	int n=read();
	for(int i=1;i<=n;i++) a[i]=read();
	int res=0;
	for(int i=0;i<60;i++)
	{
		for(int j=1;j<=n;j++) b[j]=(a[j]>>i)&1;
		int s0=0,s1=0;
		int ans=0;
		for(int j=1;j<=n;j++)
		{
//			printf("%d ",b[j]);
			if(b[j]==0) s0++,ans+=s1;
			else s1++,ans+=s0;
		}
		ans%=mod;
//		cout<<ans<<endl;
		res=(res+ans*qpow(2,i))%mod;
	}
	cout<<res<<endl;
#ifdef __LOCAL__
	printf("Time Used : %d\n",clock());
#endif
	return 0;
}



Measured memory_bytes: 4992
#include<stdio.h>

struct data{
  char name[10];
  int time;
};


int main(){

  int n,q,i,head=0,tail,sum=0;
  struct data Q[100000];

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

  for(i=0;i<n;i++){
    scanf("%s%d",Q[i].name,&Q[i].time);
  }

  tail = n;
  
  while(1){

    if(head == tail)break;
    
    if(Q[head].time<=q){
      sum = sum + Q[head].time;
      printf("%s %d\n",Q[head].name,sum);
      if(head == n)head = 0;
      else head++;
    }
    else{
      Q[head].time = Q[head].time - q;
      sum = sum + q;
      Q[tail] = Q[head];
      if(tail == n){
	tail = 0;
	head++;
      }
      else {
	tail++;
	if(head == n)head = 0;
	else head++;
      }
    }
  }
      
  return 0;
}

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

using namespace std;

void Main() {
    string S;
    cin >> S;

    int N = S.size();
    char curr = S[0];
    int ans = 0;
    for (int i = 1; i < N; ++i) {
        if (curr != S[i]) {
            ++ans;
            curr = S[i];
        }
    }
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3752
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>

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 = 10e9;
	for (int p = -100; p <= 100; p++) {
		int tmp = 0;
		for (int i = 0; i < n; i++)tmp += pow(a[i] - p, 2);
		ans = min(ans, tmp);
	}

	cout << ans << endl;
}

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

#define ll long long

int main()
{
    ll n,k;
    cin>>n>>k;
    //cout<<(n%k)<<"\n";

    ll cont;
    cont=n%k;
    if(abs(cont-k)<cont)cout<<abs(cont-k);
    else cout<<cont;
    cout<<"\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define int long long
#define double long double
const int INF = 1e18, MOD = 1e9 + 7;
int n, a, b, c, d;
map<int, int> memo;

int dp(int n) {
    if (n == 0) return 0;
    if (n == 1) return d;
    if (memo.count(n)) return memo[n];

    int ret = INF;
    if (n < INF / d) ret = n * d;

    int up, down;
    down = n / 2 * 2;
    up = (n + 1) / 2 * 2;
    ret = min(ret, abs(down - n) * d + a + dp(down / 2));
    ret = min(ret, abs(up - n)   * d + a + dp(up / 2));

    down = n / 3 * 3;
    up = (n + 2) / 3 * 3;
    ret = min(ret, abs(down - n) * d + b + dp(down / 3));
    ret = min(ret, abs(up - n)   * d + b + dp(up / 3));

    down = n / 5 * 5;
    up = (n + 4) / 5 * 5;
    ret = min(ret, abs(down - n) * d + c + dp(down / 5));
    ret = min(ret, abs(up - n)   * d + c + dp(up / 5));

    memo[n] = ret;

    return ret;
}

signed main() {
    int t;
    cin>>t;
    for (int i = 0; i < t; i++) {
        memo.clear();
        cin>>n>>a>>b>>c>>d;
        cout<<dp(n)<<endl;
    }
}

Measured memory_bytes: 4436
n, c, k = gets.split.map(&:to_i)
t = Array.new(n){gets.to_i}.sort
cnt = 1
ans = 0
lim = t[0]
1.upto(n.pred) do |i|
  if t[i] - lim > k && lim > 0
    ans += 1
    cnt = 0
    lim = 0
  end
  cnt += 1
  lim = t[i] if lim == 0
  if cnt == c
    ans += 1
    cnt = 0
    lim = 0
  end
end
ans += 1 if cnt > 0
puts ans

Measured memory_bytes: 4472
/*siddharth goyal*/
#include<bits/stdc++.h>
using namespace std;
#define   pb              push_back
#define   REP(i,n)        for(i=1;i<=n;i++)
#define   FOR(i,a,b)      for(i=a;i<=b;i++)
#define   all(v)          v.begin(),v.end()
#define   F               first
#define   S               second
#define   vl              vector<LL>
#define   itr             ::iterator it
#define   lb              lower_bound
#define   ub              upper_bound
#define   LL              long long
#define   ULL             unsigned long long
LL n,i,j,ans = 0;
LL a[1000000] ; 
int main()
{   // Read the constraints,highlights,Time Limit,Test Cases
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    LL n ; 
    cin>>n ; 
    REP(i,n) cin>>a[i] ;
    vl V,V1,V2(n+3) ;  
    sort(a+1,a+1+n) ;
    for(i=n;i>n/2;i--) V.pb(a[i]) ; 
    LL p = 0; 
    for(i=1;i<=n/2;i++) V1.pb(a[i]) ;
    LL k = 0 ;  
    for(i=3;i<=n;i+=2)  V2[i] = V[k++] ;
    V2[1] = V[V.size()-1] ; 
    k = 0 ; 
    for(i=2;i<=n;i+=2)  V2[i] = V1[k++] ;
    for(i=2;i<=n;i++) p = p + abs(V2[i]-V2[i-1]) ; 
    ans = max(p,ans) ; 
    k = 0 ;
    if(n%2)
    {  V.clear() ; V1.clear() ; 
      for(i=n;i>n/2+1;i--) V.pb(a[i]) ; 
      for(i=1;i<=n/2+1;i++) V1.pb(a[i]) ;
      k = 0 ;  
      for(i=3;i<=n;i+=2) V2[i] = V1[k++] ;
      V2[1] = V1[V1.size()-1] ; 
      k = 0 ; 
      for(i=2;i<=n;i+=2) V2[i] = V[k++] ;  
      p = 0 ; 
      for(i=2;i<=n;i++) p = p + abs(V2[i]-V2[i-1]) ; 
      ans = max(p,ans) ; 
    }
    else
    { for(i=3;i<=n;i+=2)  V2[i] = V1[k++] ;
      k = 0 ; 
      V2[1] = V1[V1.size()-1] ; 
      for(i=2;i<=n;i+=2)  V2[i] = V[k++] ;
      p = 0 ;
      for(i=2;i<=n;i++) p = p + abs(V2[i]-V2[i-1]) ; 
      ans = max(p,ans) ; 
    }
    cout<<ans ;    

}
//Check for 0,1 and other corner cases.

Measured memory_bytes: 3064
//
//  main.cpp
//  CoderTest
//
//  Created by yuya on 2019/05/20.
//  Copyright © 2019 yuya. All rights reserved.
//

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



ll findgcd(ll,ll);

int main(){
    
    int N;
    cin >> N;
    
    int shippai=0;
    string Wp,W;
    set<string> wds;
    cin >> Wp;
    wds.insert(Wp);
    for(int i=1;i<N;i++){
        cin >> W;
        if(wds.find(W) != wds.end()) {
            shippai = 1;
        } else {
            wds.insert(W);
        }
        if(Wp[Wp.length()-1]!=W[0]) shippai = 1;
        Wp = W;
    }
    
    if(shippai) cout << "No" << endl;
    else cout << "Yes" << endl;
    
    return 0;
}


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

#define REP(i,n) for (int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()

using namespace std;

using ll = long long;

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

    int N, K;
    cin >> N >> K;
    K = min(K, 1000);
    vector<int> A(N);
    REP(i, N) cin >> A[i];

    while (K-- > 0) {
        vector<int> B(N + 1);
        REP(i, N) {
            B[max(i - A[i], 0)] += 1;
            B[min(i + A[i] + 1, N)] -= 1;
        }
        REP(i, N) {
            B[i + 1] += B[i];
        }
        A = B;
    }

    REP(i, N) {
        cout << A[i] << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 5560
c=[list(map(int, input().split())) for _ in range(3)]
ans='Yes'
if c[0][0]-c[1][0]!=c[0][1]-c[1][1] or c[0][1]-c[1][1]!=c[0][2]-c[1][2] or c[1][0]-c[2][0]!=c[1][1]-c[2][1] or c[1][1]-c[2][1]!=c[1][2]-c[2][2] or c[0][0]-c[0][1]!=c[1][0]-c[1][1] or c[1][0]-c[1][1]!=c[2][0]-c[2][1] or c[0][1]-c[0][2]!=c[1][1]-c[1][2] or c[1][1]-c[1][2]!=c[2][1]-c[2][2]:
  ans='No'
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <queue>
#include <cstdio>
#include <cstdlib>

const int N = 100;
const int WHITE = 0;
const int BLACK = 1;

int n, adj_mat[N][N];
int d[N];
int distance;
bool color[N];

int Next(int node_id)
{
    for (int i = 0; i < n; i++) {
        if (adj_mat[node_id][i] == 1 && color[i] == WHITE) {
            color[i] = BLACK;
            return i;
        }
    }
    return -1;
}

void BFS()
{
    int node_id = 0;
    std::queue<int> q;
    q.push(node_id);
    d[node_id] = 0;
    color[node_id] = BLACK;

    while (!q.empty()) {
        int target = q.front();
        q.pop();
        while (1) {
            int next = Next(target);
            if (next < 0) break;
            q.push(next);
            d[next] = d[target] + 1;
        }
    }
}

void Init(int n)
{
    distance = 0;
    for (int i = 0; i < n; i++) {
        d[i] = 0;
        color[i] = WHITE;
        for (int j = 0; j < n; j++) {
            adj_mat[i][j] = 0;
        }
    }
}

int main(int argc, char *argv[])
{
    scanf("%d", &n);

    Init(n);    

    // make adj matrix
    for (int i = 0; i < n; i++) {
        int node_id, adj_num;;
        scanf("%d", &node_id);
        scanf("%d", &adj_num);
        node_id--;
        for (int j = 0; j < adj_num; j++) {
            int adj_id;
            scanf("%d", &adj_id);
            adj_id--;
            adj_mat[node_id][adj_id] = 1;
        }
    }

    // depth search
    BFS();
    for (int i = 0; i < n; i++) {
        if (color[i] == WHITE) d[i] = -1;
    }

    // dump adj matrix
    for (int i = 0; i < n; i++) {
        fprintf(stdout, "%d %d\n", i+1, d[i]);
    }

    return 0;
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {

            var a = int.Parse(Console.ReadLine());
            var b = int.Parse(Console.ReadLine());
            var c = int.Parse(Console.ReadLine());
           
            Console.Write((a+b)*c/2);

           System.Threading.Thread.Sleep(1000);
        }
    }
}


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

using namespace std;
using lint = long long;
//typedef long long lint;

int main(void)
{
    int N;
    cin >> N;
    vector<lint> A(N);

    bool zero = false;
    lint mainus_cnt = 0;
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    lint absmin = abs(A[0]);
    lint sum = 0;
    for(int i = 0; i < N; i++){
        sum += abs(A[i]);
        if(A[i] == 0){
            zero = true;
        }
        if(A[i] < 0){
            mainus_cnt++;
        }
        if(absmin > abs(A[i])){
            absmin = abs(A[i]);
        }
    }

    if(zero){
        cout << sum << endl;
    }else if(mainus_cnt % 2 == 0){
        cout << sum << endl;
    }else{
        cout << sum - 2 * absmin << endl;
    }

}

Measured memory_bytes: 1024
N = int(input())
F = [0 for i in range(N+1)]


def fib(n):
    if n == 0 or n == 1:
        F[n] = 1
        return F[n]

    if F[n]:
        return F[n]

    F[n] = fib(n-2) + fib(n-1)
    return F[n]


def main():
    print(fib(N))


if __name__ == '__main__':
    main()



Measured memory_bytes: 5604
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int> 

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

  int idx = lower_bound(all(A),K) - A.begin();
  cout << min(idx, M-idx) << endl;  

  // cout << fixed << setprecision(6);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
int main()
{ 
	int f=1; 
	string s; 
	cin >> s; 
	for(int i=1; i<s.size(); i++)
	{ 
	if(s[i]==s[i-1])f=0; 
	} 
	if(f==1)
	cout<<"Good"<<endl; 
	else 
	cout<<"Bad"<<endl; 
	return 0;
}

Measured memory_bytes: 256
import java.util.*; 
import java.io.*;

public class Main {
	static int dp[][] = new int[1005][1005]; 
	static char a[][] = new char[1005][1005];
	static int vis[][] = new int[1005][1005]; 
	static int n , m; 
	public static int fun(int i , int j) {
		if(vis[i][j] == 1)
			return dp[i][j]; 
		
		if(i >= n || j >= m) 
			return 0;
		if(a[i][j] == '#') 
			return 0; 
		if(i == n-1 && j == m-1) 
			return dp[i][j] = 1; 
	     
		vis[i][j] = 1;
		return dp[i][j] = (fun(i+1,j) + fun(i , j+1)) % (int) (1e9 + 7); 
	}
	
	public static void solve(InputReader in) {
		 n = in.readInt(); 
		 m = in.readInt(); 
		 
		
		for(int i = 0; i<n; i++) {
			char s[] = in.readString().toCharArray(); 
			for(int j = 0; j<m; j++) {
				a[i][j] = s[j]; 
			}
		}
		
//		for(int i = 0; i<1005; i++) {
//			for(int j = 0; j<1005; j++) {
//				dp[i][j] = -1; 
//			}
//		}
	    System.out.println(fun(0,0)); 
	}

	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		int t = 1; 
		while (t-- > 0)
			solve(in);
	}
}

class InputReader{
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	 public InputReader(InputStream stream) {
		this.stream = stream;
	}

     public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

     public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

     public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

     public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
     public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}
     
     public String next() {
		return readString();
	}
    
     public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


Measured memory_bytes: 61004
import java.util.*;
import java.io.*;
import static java.lang.System.*;
 
class FastScanner {
  private final InputStream in = System.in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;
  private boolean hasNextByte() {
      if (ptr < buflen) {
          return true;
      }else{
          ptr = 0;
          try {
              buflen = in.read(buffer);
          } catch (IOException e) {
              e.printStackTrace();
          }
          if (buflen <= 0) {
              return false;
          }
      }
      return true;
  }
  private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
  private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
  public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
  public String next() {
      if (!hasNext()) throw new NoSuchElementException();
      StringBuilder sb = new StringBuilder();
      int b = readByte();
      while(isPrintableChar(b)) {
          sb.appendCodePoint(b);
          b = readByte();
      }
      return sb.toString();
  }
  public long nextLong() {
      if (!hasNext()) throw new NoSuchElementException();
      long n = 0;
      boolean minus = false;
      int b = readByte();
      if (b == '-') {
          minus = true;
          b = readByte();
      }
      if (b < '0' || '9' < b) {
          throw new NumberFormatException();
      }
      while(true){
          if ('0' <= b && b <= '9') {
              n *= 10;
              n += b - '0';
          }else if(b == -1 || !isPrintableChar(b)){
              return minus ? -n : n;
          }else{
              throw new NumberFormatException();
          }
          b = readByte();
      }
  }
  public int nextInt() {
      long nl = nextLong();
      if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
      return (int) nl;
  }
  public double nextDouble() { return Double.parseDouble(next());}
}
 
class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    FastScanner sc = new FastScanner();
    String S = sc.next();
    String T = sc.next();
    Map<Character, Character> alphabetS = new HashMap<Character, Character>();
    Map<Character, Character> alphabetT = new HashMap<Character, Character>();
    boolean check = true;
    for(int i=0; i<S.length(); i++){
      char ss = S.charAt(i);
      char tt = T.charAt(i);   
      if(alphabetS.get(ss) != null){
        if(!alphabetS.get(ss).equals(tt)){
          check = false;
          break;
        }
      }else{
        alphabetS.put(ss, tt);
      }
      if(alphabetT.get(tt) != null){
        if(!alphabetT.get(tt).equals(ss)){
          check = false;
          break;
        }
      }else{
        alphabetT.put(tt, ss);
      }
    }
    if(check == true) out.println("Yes");
    else out.println("No");
  }
 
  public static int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  }
}

Measured memory_bytes: 26900
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;

    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        String S = sc.next();
        System.out.println(S.substring(S.indexOf('A'), S.lastIndexOf('Z')+1).length());
    }

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


Measured memory_bytes: 25812
#include<iostream> 
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<algorithm>
#define eps 1e-10
#define inf 1e9
#define For(i,j,k)	for(int i=j;i<=k;++i)
#define Dow(i,j,k)	for(int i=k;i>=j;--i)
#define ll long long
#define y1 orz
using namespace std;
inline ll read()
{
	ll t=0,f=1;char c=getchar();
	while(c<'0'||c>'9')	{if(c=='-')	f=-1;c=getchar();}
	while(c>='0'&&c<='9')	t=t*10+c-48,c=getchar();
	return t*f;
}
int n,h,F[1001],deg[1001],hav[1001],is_father[1001];
inline int get(int x){return x==F[x]?F[x]:F[x]=get(F[x]);}
int x,y,x1,y1,tx,ty;
int main()
{
	n=read();h=read();
	For(i,1,1000)	F[i]=i;
	For(i,1,n)	
	{
		x=read();y=read();x1=read();y1=read();
		if(x1==0)	tx=x;else tx=-x1;
		if(y1==0)	ty=-y;else ty=y1;
		tx+=500;ty+=500;
		deg[tx]++;deg[ty]--;hav[tx]=1;
//		cout<<tx<<' '<<ty<<endl;
		F[get(tx)]=get(ty);
	}
	For(i,501,1000)	if(deg[i]<0)	{puts("NO");return 0;}		
	For(i,1,500)	if(deg[i]>0)	{puts("NO");return 0;}
	For(i,1,1000)	
		hav[get(i)]|=hav[i];
	For(i,1,1000)
		if(deg[i])is_father[get(i)]=1;
	For(i,1,1000)	
		if(hav[i])
			if(F[i]==i&&!is_father[i])	return puts("NO"),0;
	puts("YES");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define size(x) ((int)(x).size())
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

pair<int,char> mem[3005][3005];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string a,b;
	cin>>a>>b;
	int sa=size(a),sb=size(b);
	For(i,0,sa) mem[i][0].F=0;
	For(i,0,sb) mem[0][i].F=0;
	For(i,1,sa)
	{
		For(j,1,sb)
		{
			if(a[i-1]==b[j-1])
			{
				mem[i][j]=make_pair(mem[i-1][j-1].F+1,'s');
			}
			else
			{
				if(mem[i-1][j]>mem[i][j-1])
					mem[i][j]=make_pair(mem[i-1][j].F,'u');
				else
					mem[i][j]=make_pair(mem[i][j-1].F,'l');
			}
		}
	}
	pii now=make_pair(sa,sb);
	string ans;
	while(now.F!=0 && now.S!=0)
	{
		if(mem[now.F][now.S].S=='s')
		{
			ans=a[now.F-1]+ans;
			now.F--; now.S--;
		}
		else
		{
			if(mem[now.F][now.S].S=='l') now.S--;
			else now.F--;
		}
	}
	cout<<ans<<"\n";
	return 0;
}

































 
 

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

#define ll long long
#define endl '\n'
#define REP(i, a, n) for(int i=a; i<n; ++i)
#define pb push_back
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const double PI = 3.141592653589793238460;
const ll mod = 1e9 + 7;

void FAST(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

int digits(ll n){
  return log10(n) + 1;
}

int main(){
  FAST();

 int n;
 cin >> n;
 set<int> arr;
 REP(i, 0, n){
     int x;
     cin >> x;
     arr.insert(x);
 }
 if(arr.size() == n)
    cout << "YES\n";
 else
    cout << "NO\n";



  return 0;
}


Measured memory_bytes: 9600
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

int solve(vector<int> &a,vector<int> &b,int x){
  vector<int> dp(x+100000);
  int n=a.size();
  rep(i,n)if(a[i]<b[i]){
    rep(j,x) MX(dp[j+a[i]],dp[j]+b[i]-a[i]);
  }
  return *max_element(dp.begin(),dp.begin()+x+1)+x;
}

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int n,d,x;
  cin>>n>>d>>x;
  vv<int> a(d);
  rep(i,d){
    a[i].resize(n);
    rep(j,n) cin>>a[i][j];
  }
  rep(i,d-1) x=solve(a[i],a[i+1],x);
  cout<<x<<endl;
  return 0;
}

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

public class Main
{

  public static void main(String[] args) throws IOException
  {
    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

    while (input.ready())
    {
      String INPUT_STR = input.readLine();
      String tmp = replaceChar(replaceChar(INPUT_STR, ',', ' '), '.', ' ');

      System.out.println(solver(tmp));
    }

  }

  private static String replaceChar(String input, char beforeChar, char afterChar)
  {
    char[] charArray = input.toCharArray();
    StringBuilder ret = new StringBuilder();
    for (char c : charArray)
    {
      if (c == beforeChar)
      {
        ret.append(afterChar);
      }
      else
      {
        ret.append(c);
      }
    }
    return ret.toString();
  }

  private static String solver(String input)
  {
    String[] stringArray = input.split(" ");
    StringBuilder ret = new StringBuilder();
    for (String string : stringArray)
    {
      if (3 <= string.length() && string.length() <= 6)
      {
        ret.append(string);
        ret.append(" ");
      }
    }
    return ret.toString().trim();
  }

}

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

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

def cal(c):
    d = []
    while c%2 == 0:
        d.append(2)
        c //= 2
    f = 3
    while f**2 <= c:
        if c%f == 0:
            d.append(f)
            c //= f
        else:
            f += 2
    if c != 1:
        d.append(c)
    return d
    
c = gcd(a, b)
d = cal(c)
print(len(set(d))+1)


Measured memory_bytes: 9196
#include<stdio.h>
#include<string.h>
int main()
{
	int i,j;
	char s[111111],a[55555]={};

	scanf("%s",s);
	for(i=0,j=0;i<strlen(s);i+=2,j++)
		a[j]=s[i];
	printf("%s\n",a);
	return 0;
}

Measured memory_bytes: 384
a, b, c = gets.split.map(&:to_i)

if a > b

 t = a

 a = b

 b = t

end

if a > c

 t = a

 a = c

 c = t

end

if b > c

 t = b

 b = c

 c = t

end

print a

print " "

print b

print " "

puts c

Measured memory_bytes: 8628
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>

using namespace std;

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

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

int main(){
    string s;
    cin >> s;
    sort(all(s));
    if(s[0] == s[1] && s[2] == s[3] && s[0] != s[2]) yOUT;
    else nOUT;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

    Scanner sc = new Scanner(System.in);

    String S = sc.next();

    if (S.equals("Sunny")) {
      System.out.println("Cloudy");
    } else if (S.equals("Cloudy")) {
      System.out.println("Rainy");
    } else if (S.equals("Rainy")) {
      System.out.println("Sunny");
    }

    sc.close();
  }
}


Measured memory_bytes: 20564
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
const long long INF = 1LL<<60; // 仮想的な無限大の値;
using namespace std;
using ll = long long;
using P  = pair<int, int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main()
{
    ll X, K, D;
    cin >> X >> K >> D;

    ll p = X;
    ll m = 1e16;
    ll r = abs(m)%D;
    vector<ll> q(3);
    ll j = 0;

    ll F = abs(p)/D;
    ll G = abs(p)%D;
    ll H = abs(G-D);
    if(K <= F)
    {
        cout << abs(X) - K*D << endl;
        return 0;
    }
    if((K-F)%2 == 0)
    {
        cout << G << endl;
    }
    else
    {
        cout << H << endl;
    }
    return 0;




    rep(i, K)
    {
        if(p > 0) p-=D;
        else p +=D;

        chmin(m, abs(p));
        
        q[j%3] = p;

        if(j > 3)
        {
            if(p == q[(j-2)%3])
            { 
                //cout << j << " "<< q[j%3] << " " << q[(j-1)%3] << " " << q[(j-2)%3] << endl;
                if((K-i)% 2 == 0)
                {
                    m = abs(q[(j-1)%3]);
                }
                else
                {
                    m = abs(p);
                }
                
                break;
            }
        }
        ++j;
        
    }
    cout << m << endl;
    return 0;
}

Measured memory_bytes: 3580
N,*A = map(int, open(0).read().split())
ans = 1
if N <= 2:
    print(1)
else:
    if A[1] > A[0]:
        dif = 1
    elif A[1] < A[0]:
        dif = -1
    else:
        dif = 0
    for i in range(2,N):
        if A[i] > A[i-1]:
            if dif == -1:
                ans += 1
                dif = 0
            elif dif == 0:
                dif = 1
        elif A[i] < A[i-1]:
            if dif == 1:
                ans += 1
                dif = 0
            elif dif == 0:
                dif = -1
    print(ans)

Measured memory_bytes: 19992
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <utility>
using namespace std;
typedef long long int lli;
int dx[6]={1, -1, 0, 0, 0, 0};
int dy[6]={0, 0, 1, -1, 0, 0};
int dz[6]={0, 0, 0, 0, 1, -1};

int main(){
	lli a,b,c;
	int n;
	cin >> a >> b >> c >> n;
	
	lli s = 2*(a*b +b*c +c*a);
	set<pair<pair<int,int>,int> > del;
	for(int i=0; i<n; i++){
		int count=0;
		int x,y,z;
		cin >> x >> y >> z;
		for(int d=0; d<6; d++){
			int nx=x+dx[d], ny=y+dy[d], nz=z+dz[d];
			if(nx<0 || ny<0 || nz<0 || nx>=a || ny>=b || nz>=c) continue;
			if(del.find(make_pair(make_pair(nx,ny),nz)) != del.end()) continue;
			count++;
		}
		s += 2*count -6;
		del.insert(make_pair(make_pair(x,y),z));
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 3140
#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.at(i);
	}
	
	sort(a.begin(), a.end());
	reverse(a.begin(), a.end());
	
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		if (i % 2 == 0) {
			ans += a.at(i);
		}
		else {
			ans -= a.at(i);
		}
	}
	
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	int N, A, B;
	cin >> N >> A >> B;
	int ans = 0;
	if (A * N > B) {
		ans = B;
	}
	else {
		ans = A*N;
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
    int n;
    string s;
    cin >> n;
    cin >> s;
    size_t size = s.length();
    for(int i = 0; i < size; i++) {
        char c = s[i];
        c = (c - 'A' + n) % 26 + 'A';
        putchar(c);
    }
    printf("\n");
    return 0;
}


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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

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

  bool can = true;

  ll a, b;
  string s;
  cin >> a >> b >> s;

  for (int i = 0; i < a; i++)
    if (!('0' <= s[i] && s[i] <= '9')) {
      puts(" No ");
      return 0;
    }
  if (s[a] != '-') {
    puts(" No ");
    return 0;
  }
  for (int i = a + 1; i <= a + b; i++)
    if (!('0' <= s[i] && s[i] <= '9')) {
      puts(" No ");
      return 0;
    }
  puts(" Yes ");
}

Measured memory_bytes: 256
from collections import Counter

def powmod(a,n,m): #a^n mod m
    ans=1
    while n!=0:
        if n&1: ans=ans*a%m
        a=a*a%m
        n>>=1
    return ans%m

n=int(input())
a=list(map(int,input().split()))
a.sort()
dic=Counter(a)
if n%2==0:
    temp={}
    for i in range(1,n,2):
        temp[i]=2
    if temp!=dict(dic):
        print(0)
        exit()
else:
    temp={}
    temp[0]=1
    for i in range(2,n,2):
        temp[i]=2
    if temp!=dict(dic):
        print(0)
        exit()
print(powmod(2,n//2,10**9+7))

Measured memory_bytes: 24732
#include <bits/stdc++.h>
#define int long long
#define maxn 200005
using namespace std;

int h[maxn], a[maxn], bit[maxn] = {};
int n;

void upd(int x, int v) {
    for(int i = x; i < maxn; i += i & (-i)) {
        bit[i] = max(bit[i], v);
    }
}

int ask(int x) {
    int ret = 0;
    for(int i = x; i > 0; i -= i & (-i)) {
        ret = max(ret, bit[i]);
    }
    return ret;
}


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> h[i];
    for(int i = 1; i <= n; i++) cin >> a[i];
    for(int i = 1; i <= n; i++) {
        int x = ask(h[i]);
        upd(h[i], a[i] + x);
    }
    cout << ask(n) << '\n';
    return 0;
}


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

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

typedef long long ll;
const ll INF = 1LL << 60;

int main ()
{
	int n;
  	cin >> n;
  	ll dp[100010];
  	for(int i = 0; i < 100010; i++)
    {
    	dp[i] = INF;
    }
  	dp[0] = 0;
  	for(int i = 0; i < n; i++)
    {
    	for(int pow6 = 1; i + pow6 <= n; pow6 *= 6)
        {
        	chmin(dp[i + pow6], dp[i] + 1);
        }
      	for(int pow9 = 1; i + pow9 <= n; pow9 *= 9)
        {
        	chmin(dp[i + pow9], dp[i] + 1);
        }
    }
  cout << dp[n] << endl;
}


Measured memory_bytes: 1024
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)

	N := scanInt()
	S := make([]string, N)
	for i := 0; i < N; i++ {
		S[i] = scanString()
	}

	T := "MARCH"
	cnt := make([]int, len(T))
	for _, s := range S {
		for j := 0; j < len(T); j++ {
			if s[0] == T[j] {
				cnt[j]++
			}
		}
	}

	ans := 0
	for i := 0; i < len(T); i++ {
		for j := i + 1; j < len(T); j++ {
			for k := j + 1; k < len(T); k++ {
				ans += cnt[i] * cnt[j] * cnt[k]
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 4284
#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<numeric>
#include<iomanip>
#include<cfloat>
using namespace std;

vector<double> makeTable(int n, int l, int r, double v, double a)
{
	vector<double> table(n, v);

	for(int i=0; i<n; i++){
		if(i < l)
			table[i] = v + a*(l - i);
		else if(i > r)
			table[i] = v + a*(i - r);
	}

	return table;
}

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

	vector<int> t(N);
	for(int i=0; i<N; i++)
		cin >> t[i];

	vector<int> v(N);
	for(int i=0; i<N; i++)
		cin >> v[i];

	const int sum_t = accumulate(t.begin(), t.end(), 0);
	int tt = 0;
	const double a = 0.5;
	vector<vector<double>> table(N+2);
	for(int i=0; i<N; i++){
		int left = 2 * tt;
		int right = left + 2 * t[i];
		table[i] = makeTable(2*sum_t+1, left, right, v[i], a);
		tt += t[i];
	}
	table[N] = makeTable(2*sum_t+1, 0, 0, 0.0, a);
	table[N+1] = makeTable(2*sum_t+1, 2*sum_t, 2*sum_t, 0.0, a);

	vector<double> graph(2*sum_t + 1, DBL_MAX);
	for(int i=0; i<table.size(); i++)
		for(int j=0; j<graph.size(); j++)
			graph[j] = min(graph[j], table[i][j]);

	double ret = 0.0;
	for(int i=0; i<graph.size()-1; i++)
		ret += (graph[i]+graph[i+1]) / 4.0;

	cout << fixed << setprecision(20) << ret << endl;

	return 0;
}


Measured memory_bytes: 32768
'use strict'

function Main(input) {
  const inputList = input.split('\n');
  const n = inputList[0]
  const numberStringList = inputList[1].split(' ')
  let numberList = []
  numberList = numberStringList.map((numberString) => Number(numberString))
  
  const sortedNumberList = numberList.sort(function(a, b){return b-a});

  let aliceTotal = 0
  let bobTotal = 0
  for (let i=0; i<n; i++) {
    if (i%2 === 0) {
      aliceTotal += sortedNumberList[i]
    } else {
      bobTotal += sortedNumberList[i]
    }
  }

  const result = aliceTotal - bobTotal

  console.log(result)
}


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

Measured memory_bytes: 21064