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

using namespace std;
#define sz(a) (int)a.size()
#define int int64_t
template<typename T1, typename T2>
ostream &operator<<(ostream &out, pair<T1, T2> &p) {
     out << "{" << p.first << ", " << p.second << "} ";//optional
     return out;
}

template<typename T1, typename T2>
istream &operator>>(istream &in, pair<T1, T2> &p) {
     in >> p.first >> p.second;
     return in;
}

template<typename T>
istream &operator>>(istream &in, vector<T> &arr) {
     for (auto &i : arr)
          in >> i;
     return in;
}

template<typename T>
ostream &operator<<(ostream &out, vector<T> &arr) {
     for (auto i : arr)
          out << i << " ";//optional
     out << endl;
     return out;
}


signed main() {
     int n;
     cin >> n;
     vector<int> a(n);
     cin >> a;
     int cntnch = 0, cnt2 = 0, cnt4 = 0;
     for (auto el : a) {
          if (el % 4 == 0) {
               cnt4++;
          } else if (el % 2 == 0) {
               cnt2++;
          } else {
               cntnch++;
          }
     }
     if (cnt2 == 0) {
          if (cntnch <= cnt4 + 1) {
               cout << "Yes";
               return 0;
          } else {
               cout << "No";
               return 0;
          }
     } else {
          if (cntnch <= cnt4) {
               cout << "Yes";
          } else {
               cout << "No";
          }
     }
}


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

using namespace std;

int main()
{
  int n;
  scanf("%d",&n);
  long int a[n],i;
  for(i=0;i<n;++i)
      scanf("%ld",&a[i]);
  
  sort(a,a+n);
  printf("%ld",a[n-1]-a[0]);
}

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

 using namespace std;
 typedef long long ll;

 int main() {
   int N;

   cin >> N;

   vector<int> a(N);
   cin >> a.at(0);
   int ans = 0;
   for (int i = 1; i < N; i++) {
     cin >> a.at(i);
   }
   for (int i = 1; i < N; i++) {
     if (a.at(i) == a.at(i - 1)) {
       ans++;
       i++;
     }
   }

   cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;                                                   
import java.util.*;
 
class Main{
     public static void main(String[] args){
             Scanner in = new Scanner(System.in);
             int a = in.nextInt();
             int b = in.nextInt();
             int c = in.nextInt();
             int[] sort = {a,b,c,};
             for(int i=0; i<2; i++){
              for(int j=0; j<2-i; j++){
               if(sort[j]<sort[j+1]){
                 int temp=sort[j];
                 sort[j]=sort[j+1];
                 sort[j+1]=temp;
               }
              }
             }
             
             System.out.println(sort[2] + " " + sort[1] + " " + sort[0]);

      }
}

Measured memory_bytes: 26080
def resolve():
    N,M = map(int,input().split())
    X = list(map(int,input().split()))
    X.sort()
    Y = [0]*(M-1)
    for i in range(M-1):
        Y[i] = abs(X[i] - X[i+1])
    Y.sort(reverse=True)
    print(abs(X[0]-X[-1])-sum(Y[:N-1]))
resolve()

Measured memory_bytes: 13968
#include <iostream>
#include <set>
using namespace std;
char s[8][8];
int dx[8]={1,1,1,0,0,-1,-1,-1};
int dy[8]={1,0,-1,1,-1,1,0,-1};
set<char*> count(int i,int j,char c){
  set<char*> ret;
  for(int lp=0,x,y;lp<8;lp++){
    x=i;y=j;
    for(int k=0;k<8;k++ ){
      x+=dx[lp]; y+=dy[lp];
      if(x<0||x>=8||y<0||y>=8||s[x][y]=='.') break;
      if(s[x][y]!=c) continue;
      if(k==0) break;
      x=i;y=j;
      while( k-- )
	ret.insert( &s[x+=dx[lp]][y+=dy[lp]] );
      break;
    }
  }
  if(!ret.empty())
    ret.insert(&s[i][j]);
  return ret;
}

void proc(int i,int j,char c,set<char*> &ret){
  if(s[i][j]=='.'){
    set<char*> tmp=count(i,j,c);
    if(tmp.size()>ret.size()&&tmp.size()>1)
      ret=tmp;
  }
}

int turn(bool f){
  char c=f?'o':'x';
  set<char*> ret;
  if(f){
    for(int i=0;i<8;i++)
      for(int j=0;j<8;j++)
	proc(i,j,c,ret);
  }else{
    for(int i=7;i>=0;i--)
      for(int j=7;j>=0;j--)
	proc(i,j,c,ret);
  }
  for(set<char*>::iterator it=ret.begin();it!=ret.end();it++)
    **it=c;
  return ret.size();
}

int main(){
  for(int i=0;i<8;i++)
    for(int j=0;j<8;j++)
      cin>>s[i][j];
  bool f=true;
  while(true){
    if(turn(f)==0){
      f=!f;
      if(turn(f)==0)
	break;
    }
    f=!f;
  }
  for(int i=0;i<8;i++){
    for(int j=0;j<8;j++)
      cout<<s[i][j];
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 1172
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;

int main() {
    ll n, t;
    cin >> n >> t;
    vector<pair<ll, ll>> v(n+1);
    for (ll i = 0; i < n; ++i) {
        ll a, b;
        cin >> a >> b;
        v[i] = make_pair(a,b);
    }
    v[n] = make_pair(0, 0);

    sort(v.begin(), v.end());

    // cerr << "Input:" << endl;
    // for (ll i = 0; i <= n; ++i ) {
    //     cerr << v[i].first << "," << v[i].second << endl;
    // }
    // cerr << endl;

    vector<vector<ll>> dp(n+1, vector<ll>(t, 0));
    //ll ans = 0;
    for (ll i = 1; i <= n; ++i) {
        for (ll j = 0; j < t; ++j) {
            dp[i][j] = dp[i-1][j];
            //ans = max(ans, v[i].second + dp[i-1][j]);
            if (j - v[i].first >= 0) {
                dp[i][j] = max(dp[i][j], dp[i-1][j - v[i].first] + v[i].second);
            }
        }

        // for (ll j = 0; j <= n; ++j ) {
        //     cerr << "dp[" << i << "][" << j << "] = " << dp[i][j] << endl;
        // }
        // cerr << endl;
    }
    //cout << ans << endl;
    ll m = 0;
    for (ll i = 1; i <= n; ++i) {
        m = max(m, dp[i-1][t-1] + v[i].second);
    }
    cout << m << endl;

    return 0;
}


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

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

  ll N, M; cin >> N >> M;
  vector<ll> G[N], to(N, 0);
  for (ll i = 0; i < M; i++) {
    ll x, y; cin >> x >> y;
    x--; y--;
    G[x].emplace_back(y);
    to[y]++;
  }

  vector<ll> dp(N, 0);
  queue<int> q;
  for (ll i = 0; i < N; i++) {
    if (to[i] == 0) q.emplace(i);
  }
  while (!q.empty()) {
    int c = q.front(); q.pop();
    for (auto n: G[c]) {
      to[n]--;
      if (to[n] == 0) {
        dp[n] = max(dp[n], dp[c] + 1);
        q.emplace(n);
      }
    }
  }
  ll ans = 0;
  for (ll i = 0; i < N; i++) {
    ans = max(ans, dp[i]);
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 7296
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Runtime.InteropServices;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;
    const char White = '.';
    const char Black = '#';

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());
        var ab = new Dictionary<int, List<int>>();
        var cc = new Dictionary<int, int>[n];

        for (int i = 0; i < n; i++) {
            ab[i] = new List<int>();
            cc[i] = new Dictionary<int, int>();
        }

        for (int i = 0; i < n - 1; i++) {
            var spl = input.ReadLine().Split(' ');
            var a = int.Parse(spl[0]) - 1;
            var b = int.Parse(spl[1]) - 1;
            var c = int.Parse(spl[2]);

            ab[a].Add(b);
            ab[b].Add(a);

            cc[Math.Min(a, b)][Math.Max(a, b)] = c;
        }

        var splx = input.ReadLine().Split(' ');
        var q = int.Parse(splx[0]);
        var k = int.Parse(splx[1]) - 1;

        var box = new long[n];
        Search(n, ab, cc, k, -1, box);

        var sb = new StringBuilder();
        for (int i = 0; i < q; i++) {
            var spl = input.ReadLine().Split(' ');
            var x = int.Parse(spl[0]) - 1;
            var y = int.Parse(spl[1]) - 1;

            sb.AppendLine((box[x] + box[y]).ToString());
        }

        return sb;
    }

    static void Search(int n, Dictionary<int, List<int>> ab, Dictionary<int, int>[] cc, int p, int from, long[] box) {
        //Debug.WriteLine(x);

        if (from != -1) {
            box[p] = box[from] + cc[Math.Min(from, p)][Math.Max(from,p)];
        }

        //次の再帰
        foreach (var to in ab[p]) {
            if (to == from) continue;
            Search(n, ab, cc, to, p, box);
        }
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 77308
//P.C.2.0.
#include <bits/stdc++.h>
using namespace std;
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define ul unsigned long int
#define mod 1000007
#define endl "\n"
////fast power
ll power(ll a,ll b){
	if(b==0)return 1;
	ll smallans=power(a,b/2);
	smallans=smallans*smallans;
	if(b%2==0)return smallans;
	else return a*smallans;}
////gcd
ll gcd(ll a,ll b){
	if(b == 0)return a;
	return gcd(b,a%b);}
int main(){
	////
	speed
    ////
    string s;
    cin>>s;
    string t;
    cin>>t;
    t=t+s;
    cout<<t<<endl;
}

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

public class Main {

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		StringBuilder builder = new StringBuilder();
		String line;
		while ((line = reader.readLine()) != null) {
			if (line.isEmpty())
				break;
			int n = Integer.parseInt(line);

			System.out.println(n * (n + 1) / 2 + 1);
		}
	}
}

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

int T[50000],S[100000];
	int binarySearch(int,int);
int main() {
	int n,i,q,j,k=0;
	scanf("%d",&n);
	for(j=0;j<n;j++) {
		scanf("%d",&S[j]);
	}
	
	scanf("%d",&q);
	for(i=0;i<q;i++) {
		scanf("%d",&T[i]);
		if(binarySearch(T[i],n)==1) k++;
	}
printf("%d\n",k);
return 0;
}
	
	int binarySearch(int key, int n) {
 int   left = 0,mid;
     int right = n;
    while( left < right) {
        mid = (left + right) / 2;
        if (S[mid] == key)
            return 1; 
        else if (key < S[mid])
            right = 	mid;
        else
            left = mid + 1;
          }
      return 0;
    
    }



Measured memory_bytes: 2264
var a:array[1..100000] of integer;n,i,cnt:integer;
begin
readln(n);
cnt:=0;
for i:=1 to n do begin
read(a[i]);
end;
for i:=1 to n do begin
if ((i=a[a[i]]) and (a[i]>i)) then cnt:=cnt+1;
end;
writeln(cnt);
end.

Measured memory_bytes: 1380
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define lower(a,x) lower_bound(all(a), x) - a.begin();
#define COUNT(a,x)  upper_bound(all(a), x) - lower_bound(all(a), x);
#define MCOUNT(a,x,y) upper_bound(all(a), y) - lower_bound(all(a), x);
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end());
#define scan(x) scanf("%lld",&x);
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
typedef set<ll> SET;
typedef double D;
const ll inf = 5555555555555555555;
const ll mod = 1000000007;
const D pi = acos(-1);
const D eps = 1e-10;

ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0, ma = 0, mi = 0;
string s;
bool ok, flag;
ll dx[4] = { 1,-1,0,0 }, dy[4] = { 0,0,1,-1 };
ll ddx[9] = { 1,-1,0,0,1,1,-1,-1,0 }, ddy[9] = { 0,0,1,-1,1,-1,1,-1,0 };
#pragma endregion
#define MAX 111111


int main(void) {
  cin >> n >> m;
  vll x(n), y(n), z(n);
  rep(i, n) {
	cin >> x[i];
	cin >> y[i];
	cin >> z[i];
  }

  ans = -inf;
  rep(a, 2) rep(b, 2) rep(c, 2) {
	vll v;
	tmp = 0;
	rep(i, n) {
	  ll vv = 0;
	  if (a) vv += x[i];
	  else vv -= x[i];
	  if (b) vv += y[i];
	  else vv -= y[i];
	  if (c) vv += z[i];
	  else vv -= z[i];

	  v.pb(vv);
	}

	sort(rall(v));
	rep(i, m) tmp += v[i];
	ma = max(ma, tmp);
  }

  cout << ma << endl;

  return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef vector<ll> vel;
typedef vector<str> ves;
#define REP(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define rep(i, b) REP(i, 0, b)
const ll mod = 1000000007;
const double pi = 3.14159265358979;

int main() {
    ll N;
    cin >> N;
    cout << "ABC" << N << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh
int count(ll x){
	int cnt = 0;
	while(x != 0){
		cnt++;
		x /= 10;
	}
	return cnt;
}
int main()
{

	int n;
	cin >> n;
	vector< int > v(n);
	int cnt[11] = {0};
	int cnt2  = 0;
	for(int i = 0 ; i < n ; i++)
	{
		int x;
		cin >> x;
		if(x >= 3200)
			cnt2++;
		else
			cnt[x/400]++;
		
	}
	int cnt1 = 0;
	for(int i = 0 ; i <= 7 ; i++){
		if(cnt[i] >= 1)
			cnt1++;
	}
	if(cnt1 == 0)
		cout << 1 << " " << cnt2 << endl;
	else
		cout << cnt1 << " " << cnt1 + cnt2 << endl;
	return 0;
} 




Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int H1, M1, H2, M2, K;
  cin>>H1>>M1>>H2>>M2>>K;
  int a = H1*60+M1;
  int b = H2*60+M2;
  cout<<max(0, b-a-K)<<endl;
}



Measured memory_bytes: 3596
import bisect
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ar = [0]*N
br = [0]*M
ar[0] = A[0]
br[0] = B[0]

for i in range(1, N):
    ar[i] = ar[i-1]+A[i]
for i in range(1, M):
    br[i] = br[i-1]+B[i]

res = bisect.bisect_right(br, K)

for i in range(N):
    if ar[i] <= K:
        res = max(i+bisect.bisect_right(br, K-ar[i])+1, res)

print(res)

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

#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__)
using ll = long long;
using namespace std;

void solve();

int main() {

	solve();
	return 0;

}

void solve() {

	ll a, b;
	cin >> a >> b;
	cout << (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0 ? "Possible" : "Impossible") << endl;

}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))

sw = 0

if(a[0]==1):
    a[0],a[1] = a[1],a[0]
    sw +=1 

for i in range(1,n-1):
    if(a[i]==i+1):
        a[i],a[i+1] = a[i+1],a[i]
        sw += 1
        
if(a[n-1]==n):
    a[n-1],a[n-2] = a[n-2],a[n-1]
    sw += 1

print(sw)

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

class BIT{
    public:
    int size;
    vector<int> tree;
    
    void set(int n){
        size = n;
        tree = vector<int>(n+1, 0);
        return;
    }
    
    void add(int n, int a) {
        int x = n;
        while (x <= size){
            tree[x] += a;
            x += (x & -x);
        }
        return;
    }
    
    int sum(int n) {
        int x = n;
        int sum = 0;
        while (x > 0) {
            sum += tree[x];
            x -= (x & -x);
        }
        return sum;
    }
    
};

int main() {
    string S;
    cin >> S;
    int K = S.size();
    
    vector<int> ccount(26, 0);
    for (char c : S) ccount[c-'a']++;
    int oddcount = 0;
    for (int n : ccount) oddcount += n%2;
    
    if (oddcount >= 2) {
        cout << -1 << endl;
        return 0;
    }
    
    ll ans = 0;
    
    string A = "", B = "", C = "";
    ll alen=0, blen=0, clen=0;
    vector<int> lcount(26, 0);
    for (char c : S) {
        int i = c-'a';
        if (lcount[i] * 2 + 1 == ccount[i]) {
            B += c;
            ans += (K-1)/2 - alen;
            blen++;
        }
        else if (lcount[i] * 2 < ccount[i]) {
            A += c;
            alen++;
        }else {
            C += c;
            ans += (K+1)/2 - (alen + blen);
            clen++;
        }
        lcount[i]++;
    }
    
    vector<vector<int>> pos(26);
    for (int i = 0; i < (K/2); i++) {
        pos[A[i]-'a'].push_back(i+1);
    }
    
    reverse(C.begin(), C.end());
    vector<int> pcnt(26, 0);
    BIT bit;
    bit.set(100010);
    for (int i = 0; i < (K/2); i++) {
        int t = C[i]-'a';
        ans += i - bit.sum(pos[t][pcnt[t]]);
        bit.add(pos[t][pcnt[t]], 1);
        pcnt[t]++;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1796
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <map>
#include <stack>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

static const int inf=1e9;

int main(){
    int n,m,x;
    cin >> n>>m>>x;
    vector<vector<int>> a(n,vector<int>(m));
    vector<int> c(n);

    rep(i,n){
        cin>>c[i];
        rep(j,m){
            cin>>a[i][j];
        }
    }
    int mmin=inf;

    for(int i=1, sz=(1<<n); i<sz; ++i){
        auto judge = [&](int tmp){
            vector<int> sum(m);
            int sumc=0;
            for(int i=0; i<n; ++i){
                if(tmp&(1<<i)){
                    rep(j,m){
                        sum[j]+=a[i][j];
                    }
                    sumc+=c[i];
                }
            }
            int ok=1;
            rep(i,m){
                if(sum[i]<x) ok=0;
            }
            if(ok) return sumc;
            return inf;
        };
        
        chmin(mmin, judge(i));
    }
    if(mmin==inf) cout <<-1<<endl;
    else cout << mmin << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}
#define _cTime (chrono::system_clock::now())
#define progress (chrono::duration_cast<chrono::milliseconds>(_cTime-_sTime).count())
#define reset _sTime=_cTime
auto reset;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int h,w,j,e;
	cin>>h>>w>>j>>e;
	cout<<(h-j)*(w-e)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define mod 1000000007
#define MOD 998244353
#define INF 40000000000000000
int dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int dy8[8] = {1, 1, 1, 0, -1, -1, -1, 0};
int dx4[4] = {-1, 0, 1, 0};
int dy4[4] = {0, -1, 0, 1};
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;
}
signed main() {
    string T;cin>>T;
    int s=T.size();
    rep(i,s){
        if(T[i]=='?'){
            T[i]='D';
        }
    }
    cout<<T<<endl;
    
}


Measured memory_bytes: 3736
#include<stdio.h>

int main(){

  int x,y,tmp;
  scanf("%d%d",&x,&y);
  if(x>=1&&y<=10E9){
    if(x<y){
      tmp=x;
      x=y;
      y=tmp;
    }
    while(tmp !=0){
      tmp=x%y;
      x=y;
      y=tmp;
    
	   }
    printf("%d\n",x);
  }
  else printf("error\n");
  return 0;
}



Measured memory_bytes: 2140
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define ff first
#define ss second
#define prec(y,x) fixed<<setprecision(y)<<x
#define inf 1e18
#define pi 3.1415926535

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int n;
	cin >> n;
	int arr[n + 1] = {0};
	int q = sqrt(n); q++; q++;
	for (int i = 1; i <= q; i++)
	{
		for (int j = 1; j <= q; j++)
		{
			for (int k = 1; k <= q; k++)
			{
				int a = 0;
				a = i * i + j * j + k * k;
				a = a + i * j + j * k + k * i;
				if (a <= n)
					arr[a]++;
			}
		}
	}
	for (int i = 1; i <= n; i++)
		cout << arr[i] << endl;
	return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <queue>
#include <cstring>

using namespace std;

int main(){
  int x,y,s;
  while(cin>>x>>y>>s){
    if(x == 0 && y == 0 && s==0)
      break;
    int tmp = 0;

    for(int i = 1;i<s;i++){
      for(int j = 1;j<s;j++){
	int t = (int)(i * (100+x)/100.0) + (int)(j * (100+x)/100.0);
	if(t == s){
	  t = (int)(i * (100+y)/100.0)+(int)(j*(100+y)/100.0);
	  tmp = max(tmp,t);
	}
      }
    }
    
    cout<<tmp<<endl;
  }

  return 0;
}

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

int fr[10];

int main(){
	f(i, 0, 4){
		int t;
		scanf("%d", &t);
		++fr[t];
	}
	printf("%s\n", fr[1] == 1 && fr[9] == 1 && fr[7] == 1 && fr[4] == 1 ? "YES" : "NO");
}

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

using ll = long long;

int main() {
    int n;
    cin >> n;
    while (n > 0) {
        string s, t;
        vector<int> d(24 * 60 * 60, 0);
        rep(i, n) {
            cin >> s >> t;
            int a = stoi(s.substr(0, 2)) * 3600 + stoi(s.substr(3, 2)) * 60 + stoi(s.substr(6, 2));
            d[a]++;
            a = stoi(t.substr(0, 2)) * 3600 + stoi(t.substr(3, 2)) * 60 + stoi(t.substr(6, 2));
            d[a]--;
        }
        int ans = 0, a = 0;
        rep(i, 24 * 60 * 60) {
            a += d[i];
            ans = max(ans, a);
        }
        cout << ans << "\n";
        cin >> n;
    }
}


Measured memory_bytes: 3544
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

template<typename T> bool InRange(T t, T l, T r){ return l <= t && t < r; }

int main(){
	
	int H,W;
	cin >> H >> W;
	int h,w;
	cin >> h >> w;
	
	cout << H * W - (h * W + w * H - h * w) << endl;
	
	
	
	
	
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
    int a[] = {1,6,1,4,5,2,6};
    int b[] = {2,3,6,5,2,1,6};
    char str[128]={0};
    while(scanf("%s",str) , str[0] != '#'){
        int len = strlen(str);
        int x=0,y=0;
        for(int i = 0; i < len; i++){
            (str[i] == 48) ? x = a[x] : x = b[x];
        }
        (x == 5) ? puts("Yes") : puts("No");
    }
    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;

int main(){
    int W,H,x,y,r;
    cin >> W >> H >> x >> y >> r;
    if(x-r>=0 && x+r<=W && y-r>=0 && y+r<=H) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 3104
using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadArrayLong();
            var N = input[0];
            var P = input[1];
            if (N == 1) { Console.WriteLine(P); return; }
            var X = (long)Math.Sqrt(P);
            var ans = 1L;
            for (long i = 2; i <= X; i++)
            {
                if (P % (long)Math.Pow(i, N) == 0) ans = i;
            }

            Console.WriteLine(ans);
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define SIZE 200005


ll fact[SIZE],inv_fact[SIZE];

ll mod_pow(ll x,ll count, ll mod){

	if(count == 0)return 1;
	ll ret = mod_pow((x*x)%mod,count/2,mod);
	if(count%2 == 1){

		ret = (ret*x)%mod;
	}
	return ret;
}

ll extgcd(ll a,ll b,ll &x,ll &y){
	ll d = a;
	if(b != 0){
		d = extgcd(b,a%b,y,x);
		y -= (a/b)*x;
	}else{
		x = 1;
		y = 0;
	}
	return d;
}

ll mod_inverse(ll a,ll m){
    ll x,y;
    extgcd(a,m,x,y);
    return (m+x%m)%m;
}


int main(){

	fact[0] = 1;
	for(ll i = 1; i < SIZE; i++){
		fact[i] = i*fact[i-1];
		fact[i] %= MOD;
	}
	inv_fact[SIZE-1] = mod_inverse(fact[SIZE-1],MOD);
	for(ll i = SIZE-1; i >= 1; i--){

		inv_fact[i-1] = inv_fact[i]*i;
		inv_fact[i-1] %= MOD;
	}

	ll N,K;
	scanf("%lld %lld",&N,&K);

	if(K >= N){

		ll mult = 2*N-1;
		for(ll i = 1; i < N; i++){

			mult *= (2*N-1-i);
			mult %= MOD;
		}

		mult *= inv_fact[N];
		mult %= MOD;

		printf("%lld\n",mult);

		return 0;
	}

	ll ans = 1; //空き部屋なし
	ans += N*(N-1); //空き部屋1つ
	ans %= MOD;

	ll mult = N,work;
	ll mult2 = N-1,work2;

	for(ll empty = 2; empty <= K; empty++){ //空き部屋の数

		mult *= (N-(empty-1));
		mult %= MOD;

		work = mult*inv_fact[empty];
		work %= MOD;
		//work = nCempty

		mult2 *= (N-empty);
		mult2 %= MOD;

		work2 = mult2*inv_fact[empty];
		work2 %= MOD;

		//work2:空き部屋にいた人の割り当て数

		ans += (work*work2)%MOD;
		ans %= MOD;
	}

	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 3328
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val c = sc.nextInt()
    val k = sc.nextInt()
    val t = (1..n).map { sc.nextInt() }.sorted()
    var ans = 0
    var start = 0
    while (start < n) {
        var to = start
        while (to < n && t[start] + k >= t[to] && to - start + 1 <= c) {
            to++
        }
        ans++
        start = to
    }
    println(ans)
}

Measured memory_bytes: 56084
<?php
$n = trim(fgets(STDIN));
  $or = true;
  for($i=1;$i<=sqrt($n);$i++) {
    if($n%$i==0) {
      if($i<10 && $n/$i<10) {
        echo "Yes";
        $or = false;
        break;
      }
    }
  }
  if($or) {
    echo "No";
  }


Measured memory_bytes: 4728
/*string palin(string s)
{
    string a;
    a=reverse(s.begin(),s.end());
    return a;
}
*/

typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s,a,b,c,d,e;
cin>>s;
int n=s.size();
a=s;
reverse(a.begin(),a.end());

if(a==s){
    b.assign(s,0,(n-1)/2);
    c=b;
    reverse(c.begin(),c.end());
    ///cout<<c<<endl;
    if(c==b){
        d.assign(s,((n+3)/2)-1,n);
        e=d;
        reverse(e.begin(),e.end());
        ///cout<<e<<endl;
        if(e==d) printf("Yes\n");
        else printf("No\n");
    }
    else printf("No\n");
}
else printf("No\n");

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define debug(x)  cout << #x << " = " << (x) << endl;
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;

int main() {
  int A, B, C; cin >> A >> B >> C;
  
  int sum = 0;
  for (int i = A; i < B*A; i += A) {
    if (i % B == C) {
      cout << "YES" << endl;
      return 0;
    }
  }
  
  cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
 
#define rep(i, _st, _ed) for(register int i = (_st); i <= (_ed); i++)
 
int n, buc[2][100009]; 
 
int main() {
//	freopen("top2_3.txt", "r", stdin); 
	cin >> n;
	rep(i, 1, n) {
		int tmp; cin >> tmp;
		buc[i%2][tmp]++;
	}
	int mx[2][2], num[2]; memset(mx, 0, sizeof mx); memset(num, 0, sizeof num);
	rep(j, 0, 1)	rep(i, 0, 100000){
		if(mx[j][0] < buc[j][i]) {
			mx[j][1] = mx[j][0];
			mx[j][0] = buc[j][i];
			num[j] = i;
		} else if(mx[j][1] < buc[j][i]){
			mx[j][1] = 	buc[j][i];
		}
	}
	/*
		error:
		if(mx[j][0] <= buc[j][i]) {
			mx[j][1] = mx[j][0];
			mx[j][0] = buc[j][i];
			num[j] = i;
		}
		因为只有当更新最大值时, 才会更新次大值...
		其实应该单独考虑
		hack:
		155 166 159
		这样这个bug程序会得到mx1 = 166, mx2 = 155的错误结果 
	*/
	int chg = 0;
	if(num[0] != num[1]) chg =  mx[0][0] + mx[1][0];
	else {
		chg = max(mx[0][0] + mx[1][1] , mx[1][0] + mx[0][1]);
    }
//    printf("%d %d\n %d %d\n", mx[0][0], mx[0][1], mx[1][0], mx[1][1]);
    cout << n-chg <<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
using Graph = vector<vector<int>>;
using Graphl = vector<vector<ll>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define FOR(itr, v) for (auto itr = (v).begin(); itr != (v).end(); ++itr)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a)  (a).rbegin(),(a).rend()
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; }
template<class T> void PrintVector(const vector<T> &vec) {for (auto val : vec) cout << val << " "; cout << endl;}
const long long INF = 1LL << 60;
const long long minusINF = -(1LL << 40);
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const int M = 1000005;

int main()
{
    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    vector<int> cnt(M);

    for (auto x : a)
    {
        if (cnt[x] != 0)
        {
            cnt[x] = 2;
            continue;
        }
        for (int i = x; i < M; i += x) cnt[i]++;
    }
    int ans = 0;
    for (auto x : a)
    {
        if (cnt[x] == 1) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8008
#include<bits/stdc++.h>
using namespace std;
int main(){
  int ans=0;
  int N,M;
  cin>>N>>M;
  vector<vector<int>> data(M);
  for(int i=0;i<M;i++){
    int k;
    cin>>k;
    for(int j=0;j<k;j++){
      int x;
      cin>>x;
      x--;
      data[i].push_back(x);
    }
  }
  vector<int> q(M);
  for(int i=0;i<M;i++)cin>>q[i];

  for(int bit=0;bit<(1<<N);bit++){
    vector<int>cnt(M,0);
    for(int i=0;i<N;i++){
      if(bit&(1<<i)){//もしスイッチiが点灯していれば
        for(int j=0;j<M;j++){
          for(int l=0;l<data[j].size();l++){
            if(data[j][l]==i)cnt[j]++;
          }
        }
      }
    }
    int tmp=0;
    for(int m=0;m<M;m++){
      if(cnt[m]%2==q[m])tmp++;
    }if(tmp==M)ans++;
  }
cout<<ans<<endl;


}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long key;

		Map<Long, Integer> a = new HashMap<>();

		for(int i = 0; i < n; i++) {
			key = sc.nextLong();
			if(a.containsKey(key)) {
				a.put(key, a.get(key) + 1);
			}else {
				a.put(key, 1);
			}

		}

		int sum = 0;

		for(int value : a.values()) {
			sum = (value % 2 != 0)? sum + 1 : sum;
		}

		System.out.println(sum);
		sc.close();
	}
}

Measured memory_bytes: 65032
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
#define fi first
#define se second
#define endl '\n'
#define y1 holyshit
#define all(x) x.begin(),x.end()
const int inf=0x3f3f3f3f;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int D,T,S; cin>>D>>T>>S;
	if(D<=T*S) cout<<"Yes";
	else cout<<"No";
	return 0;
}

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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();
        int[] arr = {a,b,c};
        Arrays.sort(arr);
        long ans = arr[0]+arr[1];
        ans += ((long) arr[2]) << k;
        System.out.println(ans);
    }
}

Measured memory_bytes: 24276
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,f[100005],tot;
int a[100005];
int main()
{
    a[++tot]=1;
    scanf("%d",&n);
    for(int i=6;i<=n;i*=6)
        a[++tot]=i;
    for(int i=9;i<=n;i*=9)
        a[++tot]=i;
	memset(f,0x3f,sizeof(f));
	f[0]=0;
    for(int i=1;i<=tot;i++)
        for(int j=a[i];j<=n;j++)
            f[j]=min(f[j],f[j-a[i]]+1);
    printf("%d",f[n]);
}


Measured memory_bytes: 512
n = int(input())
x = 0 # count
s = []
L1 = [6**k for k in range(1, 7)]
L2 = [9**k for k in range(0, 6)]
for k in range(0, n//6 + 1):
    x = 0
    j = 0
    n0 = 6 * k
    while n0 > 0:
        if n0 >= L1[5 - j]:
            n0 -= L1[5 - j]
            x += 1
        else:
            j += 1
    i = 0
    n1 = n - 6 * k
    while n1 > 0:
        if n1 >= L2[5 - i]:
            n1 -= L2[5 - i]
            x += 1
        else:
            i += 1
    s.append(x)
print(min(s))

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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

int main ()
{
    int x , y ;
    int baba ;

    cin >> x >> y ;

    if (y % 2 ==0)
    {
        baba = x + (y / 2) ;
        cout << baba ;
    }

    return 0 ;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
    string a;
    cin >> a;
    int len=a.size();
    //0
    char c=a[0];
    int sum1=0;
    int sum2=0;
    if (c=='0')
    {
        sum1=0;
        for (int i=1;i<len;i++)
        {
            if (i&1)
            {
                if (a[i]!='1')sum1++;
            }
            else if (a[i]!='0')sum1++;
        }
        for (int i=0;i<len;i++)
        {
            if (i&1)
            {
                if (a[i]!='0')sum2++;
            }
            else if (a[i]!='1')sum2++;
        }
    }
    else
    {
        sum1=0;
        for(int i=1;i<len;i++)
        {
            if (i&1)
            {
                if (a[i]!='0')sum1++;

            }
            else if (a[i]!='1')sum1++;
        }
        for (int i=0;i<len;i++)
        {
            if (i&1)
            {
                if (a[i]!='1')sum2++;
            }
            else if (a[i]!='0')sum2++;
        }
    }
    cout << min(sum1,sum2) <<endl;
}


Measured memory_bytes: 512
from collections import Counter
S = list(input())
S = Counter(S)
S = list(S.keys())
S.sort()
for i in range(26):
    alph = chr(ord("a") + i)
    #print(alph)
    if i == len(S):
        print(chr(ord("a") + i))
        exit()
    elif S[i] != chr(ord("a") + i):
        print(alph)
        exit()

print("None")

Measured memory_bytes: 4332
n = int(input())

def dfs(s):
    if int(s) > n:
        return 0
    count = dfs(s + '3') + dfs(s + '5') + dfs(s + '7')
    if '3' in s and '5' in s and '7' in s:
        count += 1
    return count

print(dfs('0'))


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

int func(int x){
  if(x<10) return x;
  return x%10+func(x/10);
}

int main(){
  int N;
  cin >> N;
  int S=func(N);
  if(N%S==0){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

/* REPmacro */
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define REPR(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define FOR(i,m,n) for(int i=(int)(m);i<(int)(n);++i)

/*alias*/
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define PB push_back
#define MP make_pair 

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

/*using*/
using ll = long long;
using ull = unsigned long long;
using unsi = unsigned;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using db = double;
using plex = complex<double>;
using vs = vector<string>;

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

/* func */

/*struct*/
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const db EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

//#define int ll
//#define int long long

signed main()
{
  int n; cin >> n;
  vi v1(n,0);
  for(auto &i:v1)
  cin >> i;
  
  int a = 0,b = 0;

  sort(ALL(v1));
  
  for(int i = n-1; i >= 0; i-=2)
    a += v1[i];
  
  for(int i = n-1; i >= 0; i-=2)
    b += v1[i-1];
  
  cout << a-b;
  return 0;
}

Measured memory_bytes: 256
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, x;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(ALL(a));
    int ans = 0;
    rep(i, n - 1)
    {
        for (int j = i + 1; j < n; j++)
        {
            chmax(ans, abs(a[j] - a[i]));
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 3656
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int j = 0;
        boolean flag = false;
        for(int i = 0; i < 25; i++){
            j = (n-4*i)/7;
            if(4*i+7*j == n && 0 <= j){ 
                flag = true;
                break;
            }
        }
        if(flag)System.out.println("Yes");
        else System.out.println("No");
    }
}

Measured memory_bytes: 21844
#include<iostream>
#include<string>
#include<cstdio>

int main(){
    using namespace std;
    
    string start,end;
    char ch;
    int sf;
    int num,size;
    int i,j,k,n=0;

    while(cin>>start){

        if(start=="-"){
            break;
        }

        size = start.size()-1;

        cin>>sf;
        for(i=0;i<sf;i++){
            cin>>num;
            
            for(j=0;j<num;j++){
                ch=start[0];

                for(k=0;k<size;k++){
                    start[k]=start[k+1];
                }
               
                start[size]=ch;
            }
        }  
        cout<<start<<endl; 
    }
    return 0;
}



Measured memory_bytes: 3184
import math
# 税がかかる金額A,B
A, B = map(int, input().split())

# 税抜きの候補
a_min_price = math.ceil(A*100/8)
a_over_price = math.ceil((A+1)*100/8)
b_min_price = math.ceil(B*100/10)
b_over_price = math.ceil((B+1)*100/10)

# 除外する組み合わせ
# 片方の最大値が最小値を超える
if((a_over_price <= b_min_price) or (b_over_price <= a_min_price)):
    print(-1)
else:
    if(a_min_price < b_min_price):
        print(b_min_price)
    else:
        print(a_min_price)

Measured memory_bytes: 3064
def MI():
    return map(int,input().split())
n,m,q=MI()
t=[[0]*(1+n) for _ in range(1+n)]
for i in range(m):
    l,r=MI()
    t[l][r]+=1
for i in range(n):
    for j in range(n):
        t[i+1][j+1]+=t[i+1][j]+t[i][j+1]-t[i][j]

for i in range(q):
    p,q=MI()
    p-=1
    print(t[q][q]-t[q][p]-t[p][q]+t[p][p])


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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}


int main(){
  int n; cin >> n;
  vector<int> num(1e6+1, 0), a(n);
  rep(i, n){
    cin >> a[i];
    num[a[i]]++;
  }

  bool pc = true;
  for(int i = 2; i <= 1e6; i++){
    int sum = 0;
    for(int j = i; j <= 1e6;){
      sum += num[j];
      j += i;
    }
    if(sum > 1){
      pc = false;
    }
  }

  if(pc){
    cout << "pairwise coprime\n";
    return 0;
  }

  int now = a[0];
  for(int i = 1; i < n; i++){
    now = gcd(now, a[i]);
  }
  if(now == 1){
    cout << "setwise coprime\n";
  }
  else{
    cout << "not coprime\n";
  }

  return 0;
}


Measured memory_bytes: 11176
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    string O, E;
    cin >> O >> E;
    REP(i, min(O.size(), E.size())) {
        cout << O[i] << E[i];
    }
    if (O.size() > E.size()) cout << O[O.size() - 1] << endl;
    else if (O.size() < E.size()) cout << E[E.size() - 1] << endl;
    else cout << endl;
    return 0;
}

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

int main() {
  int card[4][13] = { {0} };
  char suit[4] = { 'S','H', 'C', 'D' };
  int n, a;
  char c;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> c >> a;
    if (c == 'S') card[0][a - 1]++;
    else if (c == 'H') card[1][a - 1]++;
    else if (c == 'C') card[2][a - 1]++;
    else card[3][a - 1]++;
  }
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 13; j++) {
      if (card[i][j] == 0) {
        cout << suit[i] << " " << j + 1 << "\n";
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3084
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] sect = new long[n];
        long[] sum = new long[n];
        sect[0] = sc.nextLong();
        sum[0] = sect[0];
        for (int i = 1; i < n; i++) {
            sect[i] = sc.nextLong();
            sum[i] = sect[i] + sum[i - 1];
        }
        double center = (double) sum[n - 1] / 2;
        double dist = Double.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            dist = Math.min(Math.abs(sum[i] - center), dist);
        }
        System.out.println((int) (dist * 2));
    }
}


Measured memory_bytes: 93716