akhauriyash/Code-Regression huggingface dataset:
n = gets.to_i
counter = [0,0,0,0]
while n > 0
  s = gets.chomp.to_s
  case s
  when "AC"
    counter[0] += 1
  when "WA"
    counter[1] += 1
  when "TLE"
    counter[2] += 1
  else
    counter[3] += 1
  end
n -= 1
end
puts "AC x " + counter[0].to_s
puts "WA x " + counter[1].to_s
puts "TLE x " + counter[2].to_s
puts "RE x " + counter[3].to_s


Measured memory_bytes: 14328
from fractions import gcd
from functools import reduce


def product(a, b):
    return a*b


N = int(input())
a = [int(i) for i in input().split()]
# 最小公倍数-1を代入すると最大
max_m = reduce(product, a)//reduce(gcd, a) - 1
ans = 0
for i in range(len(a)):
    ans += max_m % a[i]
print(ans)


Measured memory_bytes: 5344
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int a,b;
  cin >> a >> b;
  cout << max({a+b,a-b,a*b}) << endl;
}

Measured memory_bytes: 3508
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> tup;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vp;
set<int> st;
int n,x,ans;
int m[1005];
int tmpmin=1e9;
int main(int argc,char const* argv[])
{
  cin >> n >> x;
  ans=n;
  for(int i=0;i<n;i++)
    {
      cin >> m[i];
      if(m[i]<tmpmin) tmpmin=m[i];
      x-=m[i];
    }
  ans+=x/tmpmin;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
Array.prototype.aggregate = function(){
  	return this.reduce((a,b)=>(a[b]=(a[b]||0)+1)&&a,{});
 }

function Main(input){
	input = input.split("\n");
  var h = input[1].split("").aggregate();
  return h['R']>h['B']?"Yes":"No";
}

// If you are interested in the algorithms I used, 
// there is no need to read down from this line.

((b,c,d)=>"undefined"!=typeof require?console.log(Main(require("fs").readFileSync("/dev/stdin","utf8"))):[b=b.split("\n").slice(1,-1).join("\n"),c=function(){try{return Main(b)}catch(f){return f.stack||f.message}}(),d=typeof c,"string"==d||(c=JSON.stringify(c)),$("<form>").append([[10,b],0,[1,d],0,[10,c]].map(f=>$(f?"<textarea>":"<br>",f&&{rows:f[0],cols:40,text:f[1]}))).appendTo("body")])(`
4
RBBR
`);

Measured memory_bytes: 21064
//Code by Mukul Totla
#include<bits/stdc++.h>
using namespace std;
#define ll long long

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

    int n,i;
    cin>>n;

    vector<int>arr(n);

    for(i=0; i<n; i++)
    {
        cin>>arr[i];
    }
    vector<int>v;
    v.push_back(arr[arr.size()-1]);
    
    for(i=arr.size()-2; i>=0; i--)
    {
      int a=arr[i];
      if(a>=v[v.size()-1])
        v.push_back(a);
    else
    {
        int x=upper_bound(v.begin(), v.end(),a)-v.begin();
        //cout<<x<<'\n';
        v[x]=a;
    }
    }
     cout<<v.size()<<'\n';
    // for(auto x: v)
    //     cout<<x<<" ";
    return 0;
}

Measured memory_bytes: 4268
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;

//#define int long long
//using ll = boost::multiprecision::cpp_int;
using ll = long long;
//constexpr int INF = 1e9;//INT_MAX=(1<<31)-1=2147483647
constexpr ll INF = (ll)1e18;//(1LL<<63)-1=9223372036854775807
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-9;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var) std::cout<<var<<std::endl
#define rep(i, n)   for(ll i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(ll i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define PI (acos(-1))
template<typename T> inline T power(T x, T n){ return n ? power(x*x%MOD,n/2)*(n%2?x:1)%MOD : 1; }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/

constexpr ll S_MAX = 100000;
ll dp[100010][13]={};
string S;

void input() {
	cin>>S;
}

void solve() {
	dp[0][0]=1;
	ll size=S.size();
	ll t=1;
	rep(i,size){
		ll sindex=size-i-1;
		if(i>0)t=(t*10)%13;
		if(S[sindex]=='?'){
			rep(k,10){
				ll s=(t*k)%13;
				rep(j,13){
					dp[i+1][(s+j)%13]+=dp[i][j];
					dp[i+1][(s+j)%13]%=MOD;
				}
			}
		}else{
			ll k=S[sindex]-'0';
			ll s=(t*k)%13;
			rep(j,13){
				dp[i+1][(s+j)%13]+=dp[i][j];
				dp[i+1][(s+j)%13]%=MOD;
			}
		}
	}
	cout<<dp[S.size()][5]<<endl;
}

signed main() {
	input();
	solve();
	return 0;
}


Measured memory_bytes: 10624
def main():
    x=int(input())
    if 400 <= x and x <= 599: print(8)
    elif 600 <= x and x <= 799: print(7)
    elif 800 <= x and x <= 999: print(6)
    elif 1000 <= x and x <= 1199: print(5)
    elif 1200 <= x and x <= 1399: print(4)
    elif 1400 <= x and x <= 1599: print(3)
    elif 1600 <= x and x <= 1799: print(2)
    elif 1800 <= x and x <= 1999: print(1)
    return

if __name__=='__main__':
    main()


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

ll euclid(ll a, ll b){
    ll small,large;
    small = min(a,b);
    large = max(a,b);
    if(small == 0) return large;
    while(large % small != 0){
        ll temp;
        temp = small;
        small = large % temp;
        large = temp;
    }
    return small;
}

int main(){
    ll n;
    cin >> n;
    ll a[n];
    for(int i = 0; i < n; i++){
        ll temp;
        cin >> temp;
        a[i] = temp;
    }
    ll ans[n];
    ll l[n+1];
    ll r[n+1];
    ll hoge = -1;
    for(int j = 0; j < n+1; j++){
        l[j] = 0;
    }
    for(int j = 0; j < n+1 ; j++){
        r[j] = 0;
    }
    for(int i = 1; i < n; i++){
        l[i] = euclid(l[i-1],a[i-1]);
    }
    for(int i = n-1; i >= 0; i--){
        r[i] = euclid(r[i+1],a[i]);
    }
    for(int i = 0; i < n; i++){
        ans[i] = euclid(l[i],r[i+1]);
        hoge = max(hoge,ans[i]);
    }
    cout << hoge << endl;

}

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

long long gcd(long long a,long long b){
  long long r,tmp;

  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

int main(){
  long long a,b;
  cin >> a >> b;

  long long g=gcd(a,b);
  cout << a*b/g << endl;
}

Measured memory_bytes: 256
x = [input() for _ in range(5)]
t = 9
fl = False
digits = 0
for idx, i in enumerate(x):
	i = str(int(i) + 10)
	digits = len(i)
	a = int(i[-1])
	if a != 0:
		if t >= a:
			t = a
			fl = True
		if digits == 1:
			x[idx] = "10"
		elif digits == 2:
			x[idx] = "".join((i[-2], "0"))
		else:
			x[idx] = "".join((i[-3], i[-2], "0"))
if not fl: t = 10
print(sum([int(_) for _ in x]) - 10 + t)


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

int main()
{
    int sx, sy, tx, ty;
    cin>>sx>>sy>>tx>>ty;

    int dx=tx-sx, dy=ty-sy;
#define S(x, d) string(x, d)
    cout<<S(dy, 'U')<<S(dx, 'R')<<S(dy, 'D')<<S(dx+1, 'L')
        <<S(dy+1, 'U')<<S(dx+1, 'R')<<"DR"<<S(dy+1, 'D')<<S(dx+1, 'L')<<"U\n";
}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;
#define MOD 1000000007
int main() {
	char *S[2];
	int N;
	scanf("%d", &N);
	for(int i = 0; i < 2; i++) {
		S[i] = new char[N];
		scanf("%s", S[i]);
	}
	long long B[2][3] = {{3,2,1},{6,2,3}};
	int x = 0, behind = 0;
	long long k = 1;
	while(x < N) {
		int l1 = S[0][x], l2 = S[1][x];
		int nb = l1 == l2 ? 0 : 1;
		k = ((k % MOD) * B[nb][behind]) % MOD;
		behind = nb + 1;
		x += nb + 1;
	}
	printf("%d", k);
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<string>

using namespace std;

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long

int main(){
    int n; cin >> n;
    map<string, int> music;
    vector<int> dur;

    rep(i, n){
        string s; int t; cin >> s >> t;
        music[s] = i;
        dur.push_back(t);
    }
    dur.push_back(0);

    string x; cin >> x;
    int j = music[x] + 1, res = 0;
    for(; j <= n; j++){
        res += dur[j];
    }
    cout << res << endl;
}

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

int n,m;
int cnt[500500];

int main(){
	cin>>n>>m;
	bool found=false;
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		if(a==1){
			cnt[b]++;
			if(cnt[b]==2){
				found=true;
			}
		}
		if(b==n){
			cnt[a]++;
			if(cnt[a]==2){
				found=true;
			}
		}
	}
	if(found){
		cout<<"POSSIBLE"<<endl;
	} else {
		cout<<"IMPOSSIBLE"<<endl;
	}
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1 << 30;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}

int gcd(int a, int b) {
  if(b == 0) return a;
  else return gcd(b, a%b);
}
int main () {
  cin.tie(0);
  cout << setprecision(10);

  int p, q; cin >> p >> q;
  int g = gcd(p, q);
  p /= g; q /= g;

  int ans = 1;
  int tmpq = q;
  for(int i=2;i*i<=tmpq;i++) {
    if(q % i == 0) {
      ans *= i;
    }
    while(q % i == 0) {
      q /= i;
    }
  }
  if(q != 1) ans *= q;
  cout << ans << endl;
}



Measured memory_bytes: 3104
#include <iostream>
#include <utility>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <array>
#include <math.h>
#include <numeric>
#include <sstream>
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
    string sa, sb, sc;
    cin >> sa >> sb >> sc;
    int a = 0;
    int b = 0;
    int c = 0;
    char z = sa[0];
    a++;
    while(a <= sa.length() && b <= sb.length() && c <= sc.length()){
        if (z == 'a') {
            z = sa[a];
            a++;
        } else if (z == 'b') {
            z = sb[b];
            b++;
        }
        else if (z == 'c') {
            z = sc[c];
            c++;
        }
    }
    if (a >= sa.length()+1) cout << 'A' << std::endl;
    else if (b >= sb.length()+1) cout << 'B' << std::endl;
    else if (c >= sc.length()+1) cout << 'C' << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(i,e) for(ll i=0;i<e;i++ )
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const ll INF = INT64_MAX;

ll i,j;

ll N,W;
V w(100),v(100);
ll dp[100+1][100000+1];

ll npzaq(ll x,ll y){
   if(dp[x][y]>=0)return dp[x][y];
   if(x==N){
      return 0;
   }
   else{
      if(y<w[x]){
         return dp[x][y]=npzaq(x+1,y);
      }
      else{
         return dp[x][y]=max(npzaq(x+1,y),npzaq(x+1,y-w[x])+v[x]);
      }
   }
}


int main(){
   cin>>N>>W;
   rep(i,N)cin>>w[i]>>v[i];
   rep(i,N)rep(j,W+1)dp[i][j]=-1;


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

}


Measured memory_bytes: 78336
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
#define maxn 200001
#define f(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rf(i,a,b) for(ll i=(ll)(a);i>=(ll)(b);i--)
#define pb(x) push_back((ll)(x))
#define pf(x) push_front((ll)(x))
#define nl cout << "\n";
 
//void ini(){
//	#ifndef ONLINE_JUDGE
//		freopen("input.txt","r",stdin);
//		freopen("output.txt","w",stdout);
//	#endif
//}

int main(){
	//ini();
 
	ll k,a,b;
	cin >> k>> a >> b;
	ll flag=0;
 	f(i,a,b+1){
 		if(i%k==0){
 			flag=1;
 			break;
 		}
 	}

 	if(flag==1){
 		cout <<"OK";nl;
 	}else{
 		cout <<"NG";nl;
 	}
}

Measured memory_bytes: 3636
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

int main() {
    fastio();

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

    if (s.size() + 1 != t.size()) {
        cout << "No\n";
        return 0;
    }

    forn(i, s.size()) {
        if (s[i] != t[i]) {
            cout << "No\n";
            return 0;
        }
    }

    cout << "Yes\n";

    return 0;
}

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

int main(){
    int h, w, i, j, r = 0;
    int x[4] = {1,0,-1,0}, y[4] = {0,1,0,-1};
    cin >> h >> w;
    char a[h][w];
    int c[h][w];
    pair<int,int> p, p2;
    queue<pair <int,int>> q;
    for(i=0; i<h; i++){
        for(j=0; j<w; j++){
            c[i][j] = 10000;
        }
    }
    for(i=0; i<h; i++){
        for(j=0; j<w; j++){
            cin >> a[i][j];
            if(a[i][j] == '#'){
                c[i][j] = 0;
                p.first = i;
                p.second = j;
                q.push(p);
            }
        }
    }
    while(!q.empty()){
        p = q.front();
        q.pop();
        for(i=0; i<4; i++){
            if(p.first+x[i] == -1 || p.first+x[i] == h || p.second+y[i] == -1 || p.second+y[i] == w){
                continue;
            }
            if(c[p.first+x[i]][p.second+y[i]] == 10000){
                c[p.first+x[i]][p.second+y[i]] = c[p.first][p.second] + 1;
                p2.first = p.first+x[i];
                p2.second = p.second+y[i];
                q.push(p2);
            }   
        }
    }
    for(i=0; i<h; i++){
        for(j=0; j<w; j++){
            r = max(c[i][j], r);
        }
    }
    cout << r;
    return 0;
}

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

using namespace std;


//ifstream in("input.txt");
//ofstream out("output.txt");
//ios::sync_with_stdio(false);
typedef pair<int,int> pii;
typedef long long int ll;

int N,x,F[100005];

int main()
{

    cin>>N;
    for(int i=0;i<N;i++)
    {

        cin>>x;
        F[x]++;
        F[x+1]++;
        F[x+2]++;

    }

    cout<<*max_element(F,F+100005);

}

Measured memory_bytes: 640
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N; cin >> N;

    F0R(i, 50000) {
        if ((int) (i * 1.08) == N) {
            cout << i << endl; return 0;
        }
    }
    cout << ":(" << endl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(); // 問題数
        int m = sc.nextInt(); // 提出回数
        Map<Integer,String> result = new TreeMap<>();
        Map<Integer,Integer> failure = new TreeMap<>();
        int successSum = 0;
        
        for(int i=0; i<m; i++){
            int p = sc.nextInt();
            String s = sc.next();
            if(s.equals("WA") && result.get(p)==null){
                if(failure.containsKey(p)){ 
                    failure.put(p, failure.get(p)+1);
                }
                else{
                    failure.put(p, 1);
                }
            }
            else if(s.equals("WA") && result.get(p).equals("AC")){
                // no done
            }
            else if(s.equals("AC") && result.get(p)==null){
                result.put(p, "AC");
                successSum++;
            }
            else{
                // no done
            }
        }
        
        int failureSum = 0;
        for(int i : failure.keySet()){
            if(result.get(i) != null){
                failureSum += failure.get(i);
            }
        }
        
        System.out.println(successSum + " " + failureSum);
    }
}

Measured memory_bytes: 69096
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

string S;

int main(){
    cin>>S;

    if(S[2]==S[3] && S[4]==S[5]){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int n;
int a[200010];

int main(void) {
	cin >> n;
	rep(i, n) cin >> a[i];
	deque<int> ans;
	rep(i, n){
		if(i % 2 == 0) ans.push_front(a[i]);
		else ans.push_back(a[i]);
	}
	vector<int> t;
	for(auto u : ans) t.push_back(u);
	if(n % 2 == 0) reverse(all(t));
	for(auto u : t) cout << u << " ";
	cout << endl;
}

Measured memory_bytes: 4728
#include<iostream>

using namespace std;

int main() {
	int A, B, C;
	int count5 = 0;
	int count7 = 0;

	//入力
	cin >> A >> B >> C;

	//並べ替えて575になるか判定
	if (A == 5) {
		count5++;
	}
	else if (A == 7) {
		count7++;
	}
	if (B == 5) {
		count5++;
	}
	else if (B == 7) {
		count7++;
	}
	if (C == 5) {
		count5++;
	}
	else if (C == 7) {
		count7++;
	}

	//結果
	if (count5 == 2 && count7 == 1) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

}

Measured memory_bytes: 256
using System;

class Test {
	static void Main() {
					for (int i = 1; i <= 9; i++) {

				for (int j = 1; j <= 9; j++) {

					int re = i * j;


				
				Console.Write ("{0}x{1}={2}", i,j,re);
Console.WriteLine();
				}
			}
	}
}

Measured memory_bytes: 19932
#include <bits/stdc++.h>
#define M 1e9+7
using namespace std;

int main(){
	int n;
	scanf("%d",&n);
	int a[n];
	for (int i=0;i<n;i++) scanf("%d",&a[i]);
	map<int,int> mp;
	for (int i=0;i<n;i++) mp[a[i]] = i;
	sort(a,a+n);
	int sum = 0;
	for (int i=0;i<n;i++){
		if (abs(i-mp[a[i]])%2==1) sum++;
	}
	cout << sum/2;
	return 0;
}


Measured memory_bytes: 5376
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl

void solve60(int a, int b, int c) {
    int yourhand = a + b;
    vector<int> v;
    FOR(i,1,11) {
        if (i == a || i == b || i == c) {}
        else v.push_back(i);
    }
    int cnt = 0;
    REP(i,7) {
        if (yourhand + v[i] <= 20) cnt++;
    }
    if (cnt / 7.0 >= 0.5) cout << "YES" << endl;
    else cout << "NO" << endl;
}

int main() {
    int C1, C2, C3;
    while (cin >> C1 >> C2 >> C3) {
        solve60(C1, C2, C3);
    }
    return 0;
}

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

int main(){
  int H, W;
  cin >> H >> W;
  
  vector<vector<char>> grid(H, vector<char>(W));
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      cin >> grid.at(i).at(j);
    }
  }
  
  // erase empty rows
  for (int i = 0; i < H; i++){
    bool allWhite = true;
    for (int j = 0; j < W; j++){
      if(grid.at(i).at(j) == '#'){
        allWhite = false;
        break;
      }
    }
    if(allWhite){
      grid.erase(grid.begin() + i);
      H--;
      i--;
    }
  }
  
  // erase empty columns
  for (int i = 0; i < W; i++){
    bool allWhite = true;
    for (int j = 0; j < H; j++){
      if(grid.at(j).at(i) == '#'){
        allWhite = false;
        break;
      }
    }
    if(allWhite){
      for (int k = 0; k < H; k++){
        grid.at(k).erase(grid.at(k).begin() + i);
      }
      W--;
      i--;
    }
  }
  
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      cout << grid.at(i).at(j);
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
import * as fs from 'fs';

// parameter "input" gets all data
function Main(input: string) {
    const r = parseInt(input);
    // const c = 2 * Math.PI * r;
    const c = 6.283185307179586 * r;

    //output
    console.log(c);
}

// Don't edit this line!
Main(fs.readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29628
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

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

	X, Y := nextInt(), nextInt()

	c, num := 0, X
	for num <= Y {
		c++
		num *= 2
	}

	fmt.Println(c)
}


Measured memory_bytes: 640
N, K = map(int, input().split())
A = list(map(int, input().split()))

minA = A.index(min(A))
ans = N

for i in range(K):
  count = 1
  left = minA - i
  right = minA + K - 1 - i
  #一回でK-1個を最小値にすることができる。
  if left >= 0:
    count += left // (K - 1)
    if left % (K - 1) != 0:
      count += 1
  if right != N -1:
    count += (N - right - 1) // (K - 1)
    if (N - right + 1) % (K - 1) != 0:
      count += 1
  if (left >= 0) and (right < N):
    ans = min(count, ans)
  #print(left, right, count)
print(ans)

Measured memory_bytes: 14008
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

ll a[MAXn],b[MAXn];
int main(){
  IOS();
  ll n;
  cin >> n;
  REP (i,n) cin >> a[i];
  REP (i,n) cin >> b[i];

  vector<ll> diff;
  REP (i,n) diff.eb(a[i]-b[i]);
  sort(ALL(diff));
  ll ans = 0;
  ll sum = 0;
  REP (i,n) if (diff[i] < 0) sum += -diff[i], ans++;

  ll tmp = 0;
  for (ll i=n-1;i>=0;i--) {
    if (tmp >= sum || diff[i] <= 0) break;
    tmp += diff[i];
    ans++;
  }
  if (tmp >= sum) cout << ans << endl;
  else cout << -1 << endl;
}


Measured memory_bytes: 2936
#include <stdio.h>
#include <string.h>
#include <ctype.h>
 
int main()
{
    char w[16], t[1024], *p;
    scanf(" %s", w);
    int ans=0;
    for(p=w; *p; p++) *p=toupper(*p);
    while(scanf(" %s", t)) {
        if(strcmp(t, "END_OF_TEXT")==0) break;
        for(p=t; *p; p++) *p=toupper(*p);
        if(strcmp(w, t)==0) ans++;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 548
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

vector<pi> solve(int n, int k){
	if((n - 1) * (n - 2) / 2 < k) return vector<pi>(0);
	
	int rem = (n - 1) * (n - 2) / 2 - k;
	vector<pi> ans;
	rep(i, n - 1) ans.emplace_back(i, n - 1);
	rep(i, n - 1) rep(j, i) if(rem-- > 0){
		ans.emplace_back(i, j);
	}
	return ans;
}

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n, k; cin >> n >> k;
	vector<pi> ans = solve(n, k);
	if(ans.empty()) cout << -1 << endl;
	else{
		cout << ans.size() << endl;
		for(pi i : ans) cout << i.first + 1 << " " << i.second + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <utility>
using namespace std;

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

int a, b;
string ans;

int main() {
  cin >> a >> b;

  if (a*b % 2 == 0) {
    ans = "Even";
  } else {
    ans = "Odd";
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
constexpr int di[] = { 0, 1, 0, -1 }, dj[] = { 1, 0, -1, 0 };
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define vmax 10000
constexpr ll inf = 100000000000000;
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/

int main(){
  string s;
  cin>>s;
  int l=s.size();
  vector<int> a(40,0);
  for(int i=0;i<l;i++){
    a[s[i]-'a']++;
  }
  for(int i=0;i<40;i++){
    if(a[i]%2!=0){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;

}


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

const int MOD=998244353;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int main(){
	int n;cin>>n;
	int ans=0;
	for(int a=1;a<=n;a++){
		for(int b=1;a*b<n;b++){
			ans++;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3524
#include <bits/stdc++.h>
 
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<ll, ll> pii;
 
#define REP(a,b,c) for(ll (a)=(b);(a)<(c);(a)++)
#define PER(a,b,c) for(ll (a)=(b);(a)>=(c);(a)--)
 
void ii(ll &x){ cin >> x; }
void is(string &x){ cin >> x; }
void oi(ll x){ cout << x << " "; }
void os(string x){ cout << x; }
void oie(ll x){ cout << x << endl; }
void ose(string x){ cout << x << endl; }
void oe(){ cout << endl; }

int main(){
    ll N;
    vector<ll> A;
    map<ll,ll> cnt;
    ii(N);
    REP(i,0,N){
        ll a;
        ii(a);
        A.push_back(a);
        cnt[a]++;
    }

    map<ll,ll> d;
    ll sum = 0;
    for(auto x:cnt){
        d[x.first] = x.second*(x.second-1)/2;
        sum+=d[x.first];
    }

    REP(i,0,N){
        ll x = (d[A[i]] == 0 ? 0 : (cnt[A[i]]-1)*(cnt[A[i]]-2)/2);
        oie(sum - d[A[i]] + x);
    }

    return 0;
}


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

int main() {
  int N,K;
  long long Ans=0;
  cin>>N>>K;

  vector<int> H(N);
  rep(i,N){cin >> H.at(i);}
  sort(H.begin(),H.end());
  rep(i,N-K){Ans+=H.at(i);}
  cout<<Ans<<endl;
}


Measured memory_bytes: 3852
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;


int main(){
    int N;
    cin >> N;
    string ans;
    vector<int> A(N);
    bool flag = true;
    for (int i=0; i<N; i++) {
        int x;
        cin >> x;
        if (x%2==0) {
            if (x%3==0 || x%5==0) {
                ;
            }
            else { flag = false; }
        }
    }
    
    if (flag) {
        ans = "APPROVED";
    }
    else { ans = "DENIED"; }
    
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef long long LL;
typedef vector<int> VI;
typedef pair<int,int> PII;
typedef pair<double,double> PDD;
const double eps=1e-6;
const int INF=0x3f3f3f3f;
const LL inf=1e18;
const double pi=acos(-1.0);
const int mod=21092013;
//LL powmod(LL a,LL b) {LL res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int ans[110][110],a[10010];
int main()
{
//    freopen("out.txt","r",stdin);
//    freopen("outt.txt","w",stdout);
    int n,m,q;
    cin>>n>>m>>q;
    for(int i=1;i<=q;i++){
        cin>>a[i];
    }
    int k=1;
    for(int i=0;i<n;i++){
        if(i&1){
            for(int j=m-1;j>=0;j--){
                if(a[k]==0) k++;
                ans[i][j]=k;
                a[k]--;
            }
        }
        else {
            for(int j=0;j<m;j++){
                if(a[k]==0) k++;
                ans[i][j]=k;
                a[k]--;
            }
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cout<<ans[i][j]<<" ";
        }
        puts("");
    }
    return 0;
}


Measured memory_bytes: 384
//#pagma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define pf push_front
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}

using namespace std;

mt19937 mrand(random_device{}()); 
const ll mod= 998244353;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

typedef pair < int , int > pii ;
typedef pair < long long  , long long > pll ;
const int N = 1e5 + 233;
int n , m;
vector < pii > ln[N];
ll dp[N] , t[N << 2];
void upd(int v, int tl , int tr , int pos){
	if(tl == tr)
		return void(t[v] = dp[pos]);
	int tm = (tl + tr) >> 1;
	if(pos <= tm)
		upd(v << 1, tl , tm , pos);
	else upd(v << 1|1, tm + 1, tr, pos);
	t[v] = min(t[v << 1] , t[v << 1|1]);	
}
int get(int v, int tl, int tr , int l , int r){
	if(l > r or l > tr or tl > r)
		return 1e15;
	if(l <= tl and tr <= r)
		return t[v];
	int tm = (tl + tr) >> 1;
	return min(get(v << 1 , tl , tm , l, r), get(v << 1|1, tm + 1 ,tr , l , r));
}
main(){
	scanf("%lld%lld" , &n , &m);
	for(int i = 1;  i <= m; i++){
		int l, r ,c;
		scanf("%lld%lld%lld" , &l , &r , &c);
		ln[r].pb({l , c});		
	}
	for(int i = 2; i <= n; i++)
		dp[i] = 1e15, upd(1 , 1 , n , i);

	upd(1 , 1 , n , 1);

	for(int i = 2 ; i <= n ; i++){
		int cur = 1e15;
		for(auto x : ln[i]){
			int tmp = get(1 , 1,  n , x.fi , i) + x.se;
			cur = min(cur , tmp);
		}
		dp[i] = cur;
		upd(1 , 1,  n, i);	
	}
	if(dp[n] >= 1e15)
		dp[n] = -1;
	ret(dp[n]);
}
                              

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()



int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll n;
  cin >> n;
  
  ll calc = n;
  ll x = 0;
  while(calc > 0) {
    x += (calc%10);
    calc /= 10;
  }
  
    
  //cout << n << "\n";
  
  cout << ( n%x==0 ?"Yes" :"No") << "\n";
  
  //cout << fixed << setprecision(15) << n << "\n";

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define MM <<" "<<
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setpercision(x)
using ll=long long;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using pl=pair<ll,ll>;
template<class T> inline bool chmin(T& a, T b){
    if(a>b){a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){
    if(a<b){a=b;return true;}return false;}
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};

int main(){
    int n;cin>>n;
    int info[n];
    rep(i,n)cin>>info[i];
    map<int,int> count1,count2;
    rep(i,n){
        if(i%2){
            if(count1.count(info[i]))count1[info[i]]++;
            else count1.emplace(info[i],1);
        }
        else{
            if(count2.count(info[i]))count2[info[i]]++;
            else count2.emplace(info[i],1);
        }
    }
    pair<int,int> max11=make_pair(0,0),max12=make_pair(0,0),max21=make_pair(0,0),max22=make_pair(0,0);
    for(auto p:count1){
        if(p.se>=max11.se)max12=max11,max11=p;
        else if(p.se>max12.se)max12=p;
    }
    for(auto p:count2){
        if(p.se>=max21.se)max22=max21,max21=p;
        else if(p.se>max22.se)max22=p;
    }
    int ans=0;
    if(max11.fi!=max21.fi)ans=n-max11.se-max21.se;
    else ans=n-max(max11.se+max22.se,max12.se+max21.se);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5376
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	double n,m,d;
	cin >> n >> m >> d;
	// cout << 2*(m-1)*(n-d)/(n*n) << endl;
	double ans = 2*(m-1)*(n-d)/(n*n);
	if(d==0) ans /= 2;
	printf("%.12f\n", ans);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int mat[110][110];
int arr[100100];
int main()	{
	int h,w;
	cin>>h>>w;
	int n;
	cin>>n;
	for(int i=0;i<n;i++)	{
		cin>>arr[i];
	}
	int r=0,c=0;
	int dir=1;
	for(int i=0;i<n;i++)	{
		int j=0;
		while(j<arr[i])	{
			mat[r][c]=i+1;
			if(dir==1)	{
				r++;
			}
			else	{
				r--;
			}
			if(r==h)	{
				c++;
				dir=-1;
				r--;
			}
			if(r==-1)	{
				c++;
				dir=1;
				r++;
			}
			j++;
		}
	}
	for(int i=0;i<h;i++)	{
		for(int j=0;j<w;j++)	{
			cout<<mat[i][j]<<" ";
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 384
import math
n = int(input())
n2 = int(math.sqrt(n))

minimum = n
for i in range(1, n2 + 1): #ｎまで調べると無駄な調べが入って間に合わんから
    if (n % i == 0):    #√ｎまででおｋ
        minimum = min(minimum, (n // i -1) + (i - 1))


print(minimum)


Measured memory_bytes: 9084
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main() {FIN
    
    int m, f, r;
    while (cin >> m >> f >> r, m != -1 or f != -1 or r != -1) {
        if (m == -1 or f == -1) cout << "F\n";
        else if (m + f >= 80) cout << "A\n";
        else if (m + f >= 65) cout << "B\n";
        else if (m + f >= 50 or (m + f >= 30 and r >= 50)) cout << "C\n";
        else if (m + f >= 30) cout << "D\n";
        else cout << "F\n";
    }
    return 0;
}


Measured memory_bytes: 3204
#include<bits/stdc++.h>
#include<bitset>
#include<random>
#include<time.h>

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 5e5 + 10;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}



// Main Code

int main()
{
  ll a, b;
  cin>>a>>b;
  cout<<(2*b - a)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
  int n;
  cin >> n;
  int ans = 0;
  rep(i,1,n+1){
    int j = 1;
    while(j*j <= n-i) {
      if ((n - i) % j == 0) {
        if ((n - i) / j == j)
          ans++;
        else
          ans += 2;
      }
      j++;
      }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>

const int INF = 1e9;

void print(std::vector<int> readVec){
    int sz = readVec.size();
    std::cout << "---" << std::endl;
    for(int i = 0; i < sz; ++i){
        std::cout << readVec.at(i) << std::endl;
    }
}
int main(){
    int n;
    std::cin >> n;

    std::vector<std::vector<int>> happy(n, std::vector<int> (3, 0));
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < 3; ++j){
            std::cin >> happy.at(i).at(j);
        }
    }

    std::vector<std::vector<int>> dp(n, std::vector<int> (3, 0));
    for(int i = 0; i < 3; ++i){
        dp.at(0).at(i) = happy.at(0).at(i);
    }
    
    for(int i = 1; i < n; ++i){
        for(int j = 0; j < 3; ++j){
            int max = 0;
            for(int k = 0; k < 3; ++k){
                if(j != k){
                    max = std::max(max, dp.at(i - 1).at(k));
                } 
            }
            dp.at(i).at(j) = happy.at(i).at(j) + max;
        }
    }

    std::cout << *std::max_element(dp.at(n - 1).begin(), dp.at(n - 1).end()) << std::endl;

    return 0;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

int main() {
  in(ll, n, k);
  ll x = n / k;
  ll ans = x * x * x;
  if (!(k & 1)) {
    ll y = (n + k / 2) / k;
    ans += y * y * y;
  }
  out(ans);
}


Measured memory_bytes: 3616
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;


fn main() {
    input!{s:chars};
    let mut ans:i64 = 0;
    for i in 0..s.len()-1 {
        if i%2==0 {continue;}
        if &s[..i/2+1] == &s[i/2+1..i+1] {
            //debug!(i, &s[..i/2+1], &s[i/2+1..i+1]);
            ans = max(ans, (i+1) as i64);
        }
    }
    println!("{}", ans);

}


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

int main() {
  int s;
  cin >> s;
  
  int dig = 1000000;
  
  map<int,int> mp;
  for (int i=1; i<=dig; i++) mp[i] = 0;
  mp[s] = 1;
  
  int cnt = 1;
  
  for (int i=0; i<dig; i++){
    if (s%2 == 0){
      s = s/2;
      mp[s]++;
    }
    else {
      s = 3*s + 1;
      mp[s]++;
    }
    
    cnt++;
    
    if (mp[s] == 2) {
      break;
    }
  }
  
  cout << cnt << endl;
}


Measured memory_bytes: 47104
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    string s;
    cin >> s;
    int count = 0;
    int a = s.size();
    for(int i=0;i<a;i++){
        if(s[i] == '1') count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256