akhauriyash/Code-Regression huggingface dataset:
using System;

namespace ALDS1_7_C
{
    class Program
    {
        public struct node
        {
            public int parent;
            public int left;
            public int right;
            public node(int parent, int left, int right)
            {
                this.parent = parent;
                this.left = left;
                this.right = right;
            }
        }
     
        static void tstart(node[] T, int n)
        {
            for (int i = 0; i < n; i++)
            {
                T[i].parent = -1;
                T[i].left = -1;
                T[i].right = -1;
            }
            for (int i = 0; i < n; i++)
            {
                var input = getsplit();
                int[] a = Array.ConvertAll(input, int.Parse);
                if (a[1] != -1)
                {
                    T[a[0]].left = a[1];
                    T[a[1]].parent = a[0];             
                }
                if (a[2] != -1)
                {
                    T[a[0]].right = a[2];
                    T[a[2]].parent = a[0];                   
                }           
            }
        }
        static int rootchecker(node[] T)
        {
            for (int i = 0; i < T.Length; i++)
            {
                if (T[i].parent == -1)
                {
                    return i;
                }
            }
            return 0;
        }
        static void preparse(int u, node[] T)
        {
            if (u == -1)
            {            
                return;
            }
            Console.Write(" "+u);
            preparse(T[u].left,T);
            preparse(T[u].right, T);
        }
        static void inparse(int u, node[] T)
        {
            if (u == -1)
            {               
                return;
            }           
            inparse(T[u].left, T);
            Console.Write(" " + u);
            inparse(T[u].right, T);
        }
        static void postparse(int u, node[] T)
        {
            if (u == -1)
            {
                return;
            }

            postparse(T[u].left, T);          
            postparse(T[u].right, T);
            Console.Write(" " + u);
        }

        static void Main(string[] args)
        {
            int n = getint();
            node[] T = new node[n];
            tstart(T, n);
            int r = rootchecker(T);
            Console.WriteLine("Preorder");
            preparse(r, T);
            Console.WriteLine();
            Console.WriteLine("Inorder");
            inparse(r, T);
            Console.WriteLine();
            Console.WriteLine("Postorder");
            postparse(r, T);
            Console.WriteLine();
        }
        public static string[] getsplit()
        {
            string[] x = Console.ReadLine().Split(' ');
            return x;
        }
        public static int getint()
        {
            int x = int.Parse(Console.ReadLine());
            return x;
        }
    }
}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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(){
    int n;cin>>n;
    string s;cin>>s;
    int sumw[n+1],sumr[n+1];
    sumw[0]=0;sumr[0]=0;
    rep(i,n){
        if(s[i]=='W'){
            sumw[i+1]=sumw[i]+1;
            sumr[i+1]=sumr[i];
        }
        else{
            sumw[i+1]=sumw[i];
            sumr[i+1]=sumr[i]+1;
        }
    }
    int ans=min(sumw[n],sumr[n]);
    for(int i=1;i<=n;++i){
        if(sumw[i]==sumr[n]-sumr[i]){
            ans=min(ans,sumw[i]);
            break;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 5252
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int A,ans=0;
		int a[105];
	cin>>A;


	for(int i=0;i<A;i++)
	cin>>a[i];
	for(int i=0;i<A;i++)
	for(int j=i+1;j<A;j++)
	ans+=a[i]*a[j];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)	for(int i=a;i<b;i++)
using namespace std;

void solve(){
	int N;
	cin>>N;
	string s,t;
	cin>>s>>t;
	rep(i,0,N){
		bool isGood=1;
		rep(j,i,N){
			if(s[j]!=t[j-i]){
				isGood=0;
			}
		}
		if(!isGood)continue;
		int len=N+i;
		cout<<len;
		return;
	}
	cout<<2*N;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
def nibun_right(a, x):
 lo, hi = 0, len(a)
 while lo < hi:
  mid = (lo+hi)//2
  if x < a[mid][0]: hi = mid
  else: lo = mid+1
 return lo
N,D,A=map(int,input().split())
lst=[0]*N
for i in range(N):
 lst[i]=list(map(int,input().split()))
 lst[i][1]=int((lst[i][1]-1)/A)+1
lst.sort()
DMG=[0]*(N+1)
ans=0
for i in range(N):
 renji=nibun_right(lst,lst[i][0]+2*D)
 Z=max(lst[i][1]-DMG[i],0)
 DMG[i]+=Z
 DMG[renji]-=Z
 ans+=Z
 DMG[i+1]+=DMG[i]
print(ans)


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n,k;
    cin >> n >> k;
    ll ans = 0;
    ll MOD = 1e9+7;
    for(i = k;i <= n;++i){
        ans += i*(n-i+1) + 1;
        ans %= MOD;
    }
    cout << ans+1 << endl;

    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
#define itn int
#define all(c) c.begin(),c.end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define ll long long
#define ull unsigned long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define mp(x, y) make_pair(x, y)
using namespace std;
 
const ll MAX_N = 2e5 + 5, inf = 1e18, mod = 1000000007;
const double PI = 3.1415926536;
int days[13] = {0, 31, 28, 31, 30, 31,30, 31, 31, 30, 31, 30, 31};
 
template<typename T>
ostream& operator <<(ostream& out, const vector<T>& mas) {
    for (const auto& x : mas) {
        out << x << ' ';
    }
    return out;
}
 
void ok() {
    cout << "Yes" << '\n';
}
 
void no() {
    cout << "No" << '\n';
}
 
inline ll nxt() {
    ll x;
    cin >> x;
    return x;
} 
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    string str;
    cin >> str;
    deque<char> s;
    for (auto& c : str) {
        s.push_back(c);
    } 
    int q = nxt();
    bool f = 1;
    while (q--) {
        int t = nxt();
        if (t == 1) {
            f ^= 1;
        } else {
            int a = nxt();
            char c;
            cin >> c;
            if (a == 1) {
                if (f) {
                    s.push_front(c);
                } else {
                    s.push_back(c);
                }
            } else {
                if (f) {
                    s.push_back(c);
                } else {
                    s.push_front(c);
                }
            }
        }
    }
    if (f) {
        while (s.size()) {
            cout << s.front();
            s.pop_front();
        }
    } else {
        while (s.size()) {
            cout << s.back();
            s.pop_back();
        }
    }

    return 0;

}

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

int main(){
  string S;
  cin >> S;
  int count = 0,count_max = 0;
  bool flag = true;
  for(int i = 0;i < S.size();i++){
    if(S.substr(i,1) == "A" || S.substr(i,1) == "T" || S.substr(i,1) == "G" || S.substr(i,1) == "C"){
      flag = true;
      count++;
    }else if(flag == true){
      flag = false;
      count_max = max(count_max,count);
      count = 0;
      continue;
    }else{
      continue;
    }
  }
  count_max = max(count_max,count);
  cout << count_max;
  return 0;
}


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

int main(){
  int N;
  cin >> N;
  
  vector <int> a(N);
  
  for (int i=0; i<N; i++){
    cin >> a.at(i);
  }
  
  int max = a.at(0);
  int min = a.at(0);
  
  for (int i=0; i<N ; i++){
    if( a.at(i) > max ){
      max = a.at(i);
    }
  }
  
   for (int j=0; j<N; j++){
    if(a.at(j) < min){
      min = a.at(j);
    }
  }
  
  cout << max - min << endl;
  
  return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2000000000)
N = int(input())
import math
l = [int(x) for x in input().split()]
tobi = [0]*(math.ceil(N/2))
tobi[0] = l[0]
for i in range(1,math.ceil(N/2)):
    tobi[i] = tobi[i-1] + l[i*2]
from functools import lru_cache
@lru_cache(maxsize=1000000000)
def motomeru(x,y):
    if y == 0 or x == 0 or x == 1:
        return 0
    elif x % 2 == 0:
        return max(motomeru(x-2,y-1)+l[x-1],tobi[math.floor((x-1)/2)])
    else:
        return max(motomeru(x-2,y-1)+l[x-1],motomeru(x-1,y))
print(motomeru(N,N//2))

Measured memory_bytes: 164912
n=int(input())
c=[]
s=[]
f=[]
for i in range(n-1):
  x,y,z=map(int,input().split())
  c.append(x)
  s.append(y)
  f.append(z)
def needtime(t,i):
  if s[i]>=t:
    T=s[i]
  else:
    if (t-s[i])%f[i]==0:
      T=t
    else:
      T=t+f[i]-(t-s[i])%f[i]
  return T+c[i]
for i in range(n):
  t=0
  for j in range(i,n-1):
    t=needtime(t,j)
  print(t)

Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const ll MOD = 1000000007;
const double EPS = 1e-9;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;


int main(void) {

    int n, k;
    cin >> n >> k;
    vi v(n);
    rep(i, n) {
        cin >> v[i];
    }
    Sort(v);
    int dp[101010];
    
    // 残りの石がi個の時，勝利状態かチェックする
    for(int i = 0; i <= k; i++) { 
        for(int j = 0; j < n; j++) { //これは取れる石のかずループ
            if(i - v[j] >= 0) {
                /*
                    石を取った時，勝利状態ならとる．
                    この時の，dp[i - v[j]]はfalseである(相手が敗北条件なので)
                    だから，falseを反転させる．

                    石を取った時，敗北条件なら保留する．
                    この時の，dp[i - v[j]]はtrueである(相手が勝利条件なので)
                    これを反転させると，falseであり，falseはorをとっても影響を与えない(保留)
                */
                dp[i] |= !dp[i - v[j]];
            }
        }
    }
    if(dp[k]) fin("First");
    else fin("Second");    


}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>

using namespace std;

string S[25000];

int main(){
  int i,j,K,k;
  string s,t[5000];
  cin >> s;
  int n=s.size();
  cin >> K;
  for (i=0;i<n;++i) {
    t[i]=s[i];
  }
  int f=0;
  if (n>10) {
    sort(t, t+n);
    for (i=0;i<n-4;++i) {
      if (t[0][0]==s[i]) {
        f=1;
        break;
      }
    }
  }
  k=0;
  for (i=0;i<n;++i) {
    if ((f==1 && s[i]==t[0][0]) || n<5 || (f==0 && (s[i]==t[0][0] || s[i]==t[1][0] || s[i]==t[2][0] || s[i]==t[3][0] || s[i]==t[4][0]))){
      for(j=i;j<n;++j) {
        if (j-i+1>5) {
          break;
        }
        S[k]=s.substr(i,j-i+1);
        k++;
      }
    }
  }
  sort(S, S+k);
  k=1;
  i=0;
  while (k!=K) {
    if (S[i+1]!=S[i]) {
      k++;
    }
    i++;
  }
  cout << S[i] << endl;
  return 0;
}


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

using namespace std;
#define ll long long
#define ld long double
const int N=2e5 + 5;
const ll mod = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    int s, w;
    cin >> s >> w;
    if(w >= s) cout << "unsafe" << endl;
    else cout << "safe" << endl;
    return 0;
}


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

int main() {
    int X,s=0,c=0;
    cin >> X;
    rep(i,X) {
        s += i+1;
        c++;
        if(s >= X)
            break;
    }

    cout << c << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

"""
参考：https://img.atcoder.jp/abc106/editorial.pdf
　　　https://www.hamayanhamayan.com/entry/2018/08/18/234325
・累積和
"""

N, M, Q = map(int, input().split())
lM, rM = [0] * M, [0] * M
pQ, qQ = [0] * Q, [0] * Q
LR = [[0] * N for i in range(N)]
# 都市番号を0-indexed
for i in range(M):
    l, r = map(int, input().split())
    lM[i], rM[i] = l-1, r-1
    LR[l-1][r-1] += 1
for i in range(Q):
    p, q = map(int, input().split())
    pQ[i], qQ[i] = p-1, q-1

# 始点固定で終点を動かした累積和を出す
cnt = [[0] * N for i in range(N)]
for i in range(N):
    cnt[i][i] = LR[i][i]
    for j in range(1, N):
        cnt[i][j] = cnt[i][j-1] + LR[i][j]

for i in range(Q):
    ans = 0
    for j in range(pQ[i], qQ[i]+1):
        # ある終点についてもう和が出てるので、
        # ここでは始点を動かして最終的な合計にする
        ans += cnt[j][qQ[i]]
    print(ans)


Measured memory_bytes: 73304
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    return a * b // gcd(a, b)


def count(X, C, D):
    ret = X - (X//C + X//D - X//lcm(C, D))
    return ret


def main():
    A, B, C, D = map(int, input().split())
    ans = count(B, C, D) - count(A-1, C, D)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 38256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
using namespace std;
// 多倍長テンプレ
/* ---------------------- ここから ---------------------- */
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
/* ---------------------- ここまで ---------------------- */
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
int Gojou(long long int A,long long int B){
  long long int result=A*A*A*A*A;
  result-=B*B*B*B*B;
  return result;
}
int main() {
  int A,B,C,K;
  cin >> A >> B >> C >> K;
  if(A>=K){
    cout << K;
  }
  else if(A+B>=K){
    cout << A;
  }
  else{
    cout << A-(K-A-B);
  }
  cout << endl;
  return 0;
}


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

#define ll long long
#define pb push_back
#define endl '\n'
#define fcin ios::sync_with_stdio(false); cin.tie(nullptr);
#define inf 0x3f3f3f3f
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

/* 
* stuff you should look for
* int overflow, array bounds
* special cases (n=1?), set tle
*/

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



Measured memory_bytes: 384
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    s=input()
    cunt1=0
    for i,ss in enumerate(s):
        if int(ss)==i%2:cunt1+=1
    cunt2=0
    for i,ss in enumerate(s):
        if int(ss)!=i%2:cunt2+=1   
    print(min(cunt1,cunt2))

if __name__=='__main__':
    main()

Measured memory_bytes: 67912
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
const ll inf = 1e9;
map<string, ll> mp;
int main(){
    int q; cin >> q;
    multiset<ll> st;
    rep(i,q){
        ll com, x;
        string key, l, r;
        cin >> com;
        if(com != 3)cin >> key;
        if(com == 0){
            cin >> x;
            mp[key] = x;
        }else if(com == 1)cout << ((mp.find(key) != mp.end())?mp[key]:0) << endl;
        else if(com == 2)mp.erase(key);
        else if(com == 3){
            cin >> l >> r;
            for(map<string, ll>::iterator it = mp.lower_bound(l); it != mp.upper_bound(r); it++)
                cout << (*it).first << " " << (*it).second << endl;
        }
    }
    return 0;
}


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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define MAX(a, b) ((a) < (b) ? (b) : (a))

const long long INF = 1LL << 60;
typedef unsigned long long ll;
const long long MOD = 1000000000 + 7;

int main()
{
    string s;
    cin >> s;
    char alph[26] = {0};
    rep(i, s.size())
    {
        int d;
        d = s[i] - 'a';
        alph[d]++;
    }
    rep(i, 26)
    {
        if (alph[i] == 0)
        {
            char out = i + 'a';
            cout << out << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
#define PER(i,a,b) for(int (i)=(a);(i)>=(b);--i)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define SZ(x) ((int)((x).size()))
#define ALL(t) t.begin(),t.end()
#define CLR(x) memset(x,0,sizeof(x))
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long double ld;
#define DBG(vari) cout<<"["<<__LINE__<<"] "<<#vari<<" = "<<(vari)<<endl;
#define FLASH ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
inline void rwFile(string file) {freopen((file+".in").c_str(),"r",stdin); freopen((file+".out").c_str(),"w",stdout);}
inline bool EQ(ld a,ld b) {return fabs(a-b)<=(1e-7);}
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;}
ll inv(ll a,ll mod) {return powmod(a,mod-2,mod);}
void clk() {cout<<" Execution Time = "<<(int)(clock()*1000./CLOCKS_PER_SEC)<<" ms\n";}
const ll inf=1000000007;
const ld pi=3.141592653589;
//==============================================CUT_BEGINS==========================================================//

int main() {
	int n; cin >> n;
	ll a[105];
	a[0] = 2; a[1] = 1;
	REP(i, 2, 100) {
		a[i] = a[i - 1] + a[i - 2];
	}
	cout << a[n] << '\n';
	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author neuivn
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {

            int A = in.nextInt();
            A += in.nextInt();
            A %= 24;
            out.println(A);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 21460
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <complex>

long long int dfs(std::string &S, long long int N, char tmpmax, long long int i){
  
  // if last letter 
  if(i == N-1){
    for(char ctmp = 'a'; (int)ctmp <= (int)tmpmax+1; ctmp++){
      S[i] = ctmp;
      std::cout << S << std::endl;
    }
    return 0;
  }

  // other cases
  for(char ctmp = 'a'; ctmp <= tmpmax; ctmp++){
    S[i] = ctmp;
    dfs(S, N, tmpmax, i+1);
  }
  S[i] = tmpmax+1;
  dfs(S, N, (char)((int)tmpmax +1), i+1);

  return 0;
}

int main(){

  long long int N;
  std::cin >> N;
  
  std::string S(N, 'a');
  std::cerr << S << std::endl;
  if(N == 1){
    std::cout << "a" << std::endl;
  }
  else{
    dfs(S, N, 'a', 1);
  }

  return 0;
}


Measured memory_bytes: 1536
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<math.h>
#include<numeric>
#include<cassert>
#include<random>
#include<deque>
#include<chrono>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
const ll E=1e17+7;
#define F first
#define S second
#define MK make_pair

const ll MX=150000;



int main(){
    vector<ll> s;
    set<ll> S;
    bool j[MX]={};
    for(int i=2;i<MX;i++){
        if(!j[i]){
            s.push_back(i);
            S.insert(i);
            for(int t=2;i*t<MX;t++){
                j[i*t]=true;
            }
        }
    }
    vector<ll> a(MX);
    for(int i=0;s[i]*2<MX;i++){
        if(S.find(s[i]*2-1)!=S.end()){a[s[i]*2-1]++;}
    }
    for(int i=1;i<a.size();i++){
        a[i]+=a[i-1];
    }
    ll q;
    cin>>q;
    for(int i=0;i<q;i++){
        ll l,r;
        cin>>l>>r;
        cout<<a[r]-a[l-1]<<endl;
    }
    
    
    return 0;
}

Measured memory_bytes: 2688
#include<stdio.h>
int main(void){
    char s[200001];
    char t[200001];
    int i;
    int count;
    scanf("%s",s);
    scanf("%s",t);
    count=0;
    for(i=0;s[i]!='\0';++i){
        if(s[i]!=t[i]){
            ++count;
        }
    }
    printf("%d\n",count);
    return 0;
}


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


bool isSafe(int num, unordered_set<int> s) {
    while (num > 0) {
        int last = num % 10;
        num /= 10;
        
        if (s.find(last) != s.end()) {
            return false;
        }
    }
    
    return true;
}

int solve(int n, unordered_set<int> s) {
    for (int i = n; i <= 10 * n; ++i) {
        if (isSafe(i, s)) {
            return i;
        }
    }
    
    return -1;
}

int main(int argc, char** argv) {
    int N, K;
    
    cin >> N >> K;
    
    unordered_set<int> dislikes;
    for (int i = 0; i < K; i++) {
        int k;
        cin >> k;
        dislikes.insert(k);
    }
    
    cout << solve(N, dislikes) << endl;
    
    return 0;
}


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

map<int, set<int>> routes;

int ans = 0;
int N;

void search(int position, vector<bool> reached, int depth)
{
    if (reached.at(position))
    {
        return;
    }
    reached.at(position) = true;

    if (depth == N)
    {
        ans++;
        return;
    }

    for (int next_position : routes[position])
    {
        int next_depth = depth + 1;
        vector<bool> reached2;
        copy(reached.begin(), reached.end(), back_inserter(reached2));
        search(next_position, reached2, next_depth);
    }
}

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

    vector<int> a(M);
    vector<int> b(M);
    rep(i, M) cin >> a.at(i) >> b.at(i);
    rep(i, M)
    {
        a.at(i)--;
        b.at(i)--;
    }

    rep(i, M)
    {
        routes[a.at(i)].insert(b.at(i));
        routes[b.at(i)].insert(a.at(i));
    }
    vector<bool> reached(N, false);
    search(0, reached, 1);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const int MOD = 1000000007;

int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

//********************************template END****************************************//

void solve(void){
	int N, M;
	cin >> N >> M;
	if (N <= 8 && M <= 8)
	{
		cout << "Yay!" << endl;
	}
	else
	{
		cout << ":(" << endl;
	}
}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define min(a,b) (a<b?a:b)
using namespace std;
typedef long long ll;
struct store
{
	ll price;
	ll cans_count;
};
void quicksort(vector<store> &v, int left, int right)
{
	ll mid = v[(left + right) / 2].price;
	int left_arrow = left, right_arrow = right;
	do
	{
		while (v[left_arrow].price < mid)
			left_arrow++;
		while (v[right_arrow].price > mid)
			right_arrow--;
		if (left_arrow <= right_arrow)
		{
			store temp = v[left_arrow];
			v[left_arrow] = v[right_arrow];
			v[right_arrow] = temp;
			left_arrow++;
			right_arrow--;

		}
	} while (left_arrow <= right_arrow);
	if (left < right_arrow)
		quicksort(v, left, right_arrow);
	if (left_arrow < right)
		quicksort(v, left_arrow, right);
}
int main()
{
	vector<store> v;
	ll n, m, a, b;
	store t;
	cin >> n >> m;
	for (int i = 0; i < n; i++)
	{
		cin >> a >> b;
		t.price = a; t.cans_count = b;
		v.push_back(t);
	}
	quicksort(v, 0, n - 1);
	ll totalCans = 0, money = 0, cans = m;
	for (int i = 0; i < n; i++)
	{
		if (totalCans == cans)
			break;
		totalCans += min(v[i].cans_count, m);
		money += min(v[i].cans_count, m)*v[i].price;
		m -= min(v[i].cans_count, m);
	}
	cout << money << endl;
	//system("pause");
	return 0;
}

Measured memory_bytes: 2420
fn get_line() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn is_odd_digits(num: u64) -> bool {
    let s_num = num.to_string();
    s_num.len() % 2 != 0
}

fn main() {
    let n = get_line().parse::<u64>().unwrap();
    let mut count = 0;
    for i in 1..n + 1 {
        if is_odd_digits(i) { count += 1; }
    }
    println!("{}", count);
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		if(A+B>=24) {
			System.out.println(A+B-24);
		}else {
		System.out.println(A + B);
		}
	}

}


Measured memory_bytes: 21972
# coding: utf-8
# Your code here!

while True:
    a, op, b = input().split()
    a = int(a)
    b = int(b)

    if op == "+":
        print(a+b)
    elif op == "-":
        print(a-b)
    elif op == "*":
        print(a*b)
    elif op == "/":
        print(a//b)
    elif op == "?":
        break


Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    long N,A[5]={0};
    string S;
 
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> S;
        if(S[0] == 'M'){
            A[0]++;
        }else if(S[0] == 'A'){
            A[1]++;
        }else if(S[0] == 'R'){
            A[2]++;
        }else if(S[0] == 'C'){
            A[3]++;
        }else if(S[0] == 'H'){
            A[4]++;
        }
    }
    long ans=0;
    for(int i=0; i<5; i++){
        for(int j=i+1; j<5; j++){
            for(int k=j+1; k<5; k++){
                ans += A[i] * A[j] * A[k];
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(t) t.begin(), t.end()
#define inrange(i, a, b) (((i)>= min((a), (b))) && ((i) <= max((a), (b))))
#define show(x) cout << #x << " is " << x << "\n";
typedef vector<ll> vi;
#define fi first
#define se second
const ll inf = 9e18;
const ll mod = 1e9 + 7;

ll power(ll x, ll y){
    ll ans = 1;
    while(y){
        if(y&1)
            ans = (x * ans);
        x = (x * x);
        y >>= 1;
    }
    return ans;
}
//const ll N = 1e5 + 1;
//vector<ll> adj[N];
//bool visited[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

	ll x;
	cin>>x;
	ll a=0, b=0;
//	while(power(a, 5) + power(b, 5) != x){
//		ll op = power(a, 5) + power(b, 5);
//		if(op < x){
//			a++;
//		}
//		else if(op > x){
//			b++;
//		}
//	}
//	cout<<a<<" "<<b;
	for(int i=-1000;i<=1000;i++){
		for(int j=-1000;j<=1000;j++){
			if(power(i, 5) - power(j, 5) == x){
				cout<<i<<" "<<j;
				return 0;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3652
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <cmath>
using namespace std;
//typedef __int64 LL;
//typedef long long int LL;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef pair<int,int> P;
//typedef pair<LL,LL> PL;

const int MOD=1000000007;
double pi=atan(1)*4;

int main(){
	double a,b,x;cin>>a>>b>>x;
	double s=x/a;
	double ans=0;
	if(s<=a*b/2)
	{
		ans=(pi/2-atan(2*s/(b*b)))*180/pi;	
	}
	else
	{
		s=a*b-s;
		ans=atan(2*s/(a*a))*180/pi;
	}
	cout<<setprecision(10)<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 256
// Package main provides
//
// File:  main.go
// Author: ymiyamoto
//
// Created on Mon Feb  4 12:20:15 2019
//
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)

	m := map[byte]int{}
	for i := 0; i < N; i++ {
		var s string
		fmt.Scan(&s)
		m[s[0]]++
	}

	ans := 0
	for _, s := range []string{"MAR", "MAC", "MAH", "MRC", "MRH", "MCH", "ARC", "ARH", "ACH", "RCH"} {
		count := 1
		for i := range s {
			count *= m[s[i]]
		}
		ans += count
	}
	fmt.Println(ans)
}


Measured memory_bytes: 5504
#pragma GCC target ("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

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; }

bool prime(int n) {
    for (int i = 2; i <= sqrt(n); i++) {
        if (n % i == 0)return false;
    }
    return n != 1;
}
int gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
int lcm(int x, int y) {
    return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
    if (p == 0) return 1;
    if (p % 2 == 0) {
        int t = mod_pow(n, p / 2, m);
        return (t * t) % m;
    }
    return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a % b, y, x);
    y -= a / b * x;
    return d;
}
int modinv(int a, int m) {
    int b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int digit(int x) {
    int cnt = 0;
    while (x > 0) {
        cnt += x % 10;
        x /= 10;
    }
    return cnt;
}
int read() {
    int tmp;
    cin >> tmp;
    return tmp;
}
int xor128() {
    static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    int t = (x xor (x << 11));
    x = y; y = z; z = w;
    return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
    map<int, int>ans;
    int now = 2;
    while (now * now <= x) {
        if (x % now == 0) {
            x /= now;
            ans[now]++;
        }
        else now++;
    }
    if (x != 1) ans[x]++;
    return ans;
}
int comb(int n, int k) {
    k = min(k, n - k);
    int x = 1, y = 1;
    rep(i, k) {
        y *= i + 1;
        y %= MOD;
    }
    for (int i = n - k + 1; i <= n; i++) {
        x *= i;
        x %= MOD;
    }
    return x * modinv(y, MOD) % MOD;
}

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

    int n, k;
    int a[200005];
    int sum[200006];
    map<int, vector<int>>mp;
    int ans = 0;

    cin >> n >> k;
    rep(i, n) cin >> a[i];
    sum[0] = 0;
    rep(i, n) sum[i + 1] = sum[i] + a[i];
    rep(i, n + 1) {
        int mod = (sum[i] - i) % k;
        mp[mod].push_back(i);
    }
    rep(i, n + 1) {
        int mod = (sum[i] - i) % k;
        ans += lower_bound(mp[mod].begin(), mp[mod].end(), i + k) - lower_bound(mp[mod].begin(), mp[mod].end(), i + 1);
    }

    cout << ans << endl;

    return 0;
}


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

int gcd(int a, int b){
    if(a == 0) return b;
    if(b == 0) return a;

    if(a < b){
        return gcd(a,b%a);
    }
    else{
        return gcd(a%b,b);
    }
}

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

    ll count = 0;
    int K;
    cin >> K;
    K++;

    for (int i = 1; i < K; i++)
    {
        for (int j = 1; j < K; j++){
            for (int k = 1; k < K; k++){
                count +=gcd(i,gcd(j,k));
            }
        }
    }

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




Measured memory_bytes: 3652
s=input()
a=s[:2]
b=s[2:]
#print(a)
#print(b)
month=["01","02","03","04","05","06","07","08","09","10","11","12"]
at=(a in month)
bt=(b in month)

if at and bt:
    print("AMBIGUOUS")
elif at:
    print("MMYY")
elif bt:
    print("YYMM")
else:
    print("NA")


Measured memory_bytes: 3060
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;

ll dp[101][100005];   //dp[i][j]: i番目までの子供がj個を分け合う場合の数
ll sdp[101][100005];

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

    vector<int> a(n);
    int i,j;
    for(i=0; i<n; i++) {
        scanf("%d", &a[i]);
    }

    dp[0][0]=1;
    for(i=1; i<=k+1; i++) sdp[0][i]=1;
    for(i=1; i<=n; i++) {
        for(j=0; j<=k; j++) {
            dp[i][j]=(sdp[i-1][j+1]-sdp[i-1][MAX(0,j-a[i-1])]+MOD)%MOD;
            sdp[i][j+1]=(sdp[i][j]+dp[i][j])%MOD;
        }
    }
    printf("%lld\n", dp[n][k]);

    return 0;
}


Measured memory_bytes: 158080
a = []
 5.times do |i|
   a[i] = gets.to_i
end

k = gets.to_i

check = true

for i in 0..3
  for j in (i + 1)..4

    if k < (a[i] - a[j]).abs then
      check = false
    end

  end
end

if check then
  puts "Yay!"
else
  puts ":("
end

Measured memory_bytes: 1788
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <set>

using namespace std;

const int nmax = 1e9 + 7;
const long long INF = 1e18;
const double PI = 2 * asin(1);
typedef long long ll;

int main(){
  ll N; cin >> N;
  vector <ll> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  
  vector <ll> loc(N + 1);
  for (int i = 0; i < N; i++) loc[A[i]] = i + 1;
  
  multiset <ll> st{0, 0, N + 1, N + 1};

  ll ans = 0;
  for (ll i = N; i >= 1; i--){
    ll cnt = 0;
    st.insert(loc[i]);
    auto itr = st.find(loc[i]); itr--; itr--;
    
    vector <ll> here(5);
    for (int j = 0; j < 5; j++){
      here[j] = *itr;
      itr++;
    }
    
    cnt += (here[1] - here[0]) * (here[3] - here[2]);
    cnt += (here[4] - here[3]) * (here[2] - here[1]);
    
    ans += cnt * i;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6528
n=int(input())
Alist=[0]+[int(input()) for i in range(n)]
 
now=1
count=0
Hist={1}
 
while now!=2:
    now=Alist[now]
    count+=1
    if now in Hist:
        count=-1
        break
    Hist.add(now)
print(count)

Measured memory_bytes: 13700
n, x = map(int, input().split())
candy_list = list(map(int, input().split()))

eat_count = 0

for i, a in enumerate(candy_list[:-1]):
  gap = candy_list[i] + candy_list[i+1] - x
  if gap <= 0:
    continue
  eat_count += gap
  if gap > 0:
    if candy_list[i+1] - gap >= 0:
      candy_list[i+1] -= gap
    else:
      candy_list[i+1] = 0
      gap -= candy_list[i+1]
      candy_list[i] -= gap

print(eat_count)


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

int main(){
  string s,t;
  cin>>s>>t;
  vector<int> start(26,-1);
  vector<int> goal(26,-1);
  for(int i=0;i<s.size();i++){
    int a=s[i]-'a';
    int b=t[i]-'a';
    
    if(start[a]!=-1||goal[b]!=-1){
      if(start[a]!=b||goal[b]!=a){
        cout<<"No"<<endl;
        return 0;
      }
    }
    start[a]=b;
    goal[b]=a;
  }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    char a, b;
    cin >> a >> b;
    int ans = 0;
    int num_a = (a == 'H') ? 1 : -1;
    int num_b = (b == 'H') ? 1 : -1;
    ans = num_a * num_b;
    char answer = ans == 1 ? 'H' : 'D';
    cout << answer << endl;
    return 0; 

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    auto nc2 = [](ll n) {return n*(n-1)/2;};

    IOS
    const int p = 2019;
    string s; cin >> s;

    vector<ll> dp(p+1);
    dp[0] =1;
    ll ans = 0;

    int mul = 1;
    int cnt = 0;
    RREP(i,s.size()-1) {
        int c = s[i] - '0';
        cnt = (cnt + c * mul) % p;
        dp[cnt]++;
        mul = (mul*10) % p;
    }

    REP(i,p) ans += nc2(dp[i]);

    cout << ans << '\n';

    return 0;
}

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

using namespace std;

typedef long long ll;
#define int ll
typedef long double ld;

typedef pair<int,int> pii;
#define x first
#define y second

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int a,b,c;
    cin>>a>>b>>c;
    cout<<(a+b<c&&4*a*b<c*c+a*a+b*b-2*a*c-2*b*c+2*a*b?"Yes\n":"No\n");
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
	int n,i,x;
	x=0;
	char a[1000000],b[1000000];
	scanf("%s",a);
	scanf("%s",b);
	n=strlen(a);
	for(i=0;i<n;i++){
		if(a[i]!=b[i]) x++;
	}
	printf("%d\n",x);
	return 0;
}


Measured memory_bytes: 2060
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

void DFS(vvll &g,vll &cnt,vll &ans,int n,int sum){
	sum += cnt.at(n) ;
	ans.at(n) = sum ;
	for(int i=0;i<g.at(n).size();i++){
		if(ans.at(g.at(n).at(i))==-1){
			DFS(g,cnt,ans,g.at(n).at(i),sum) ;
		}
	}
}

int main(){
	ll n,k ;
	cin >> n >> k ;
	vvll g(n,vll(0)) ;
	for(int i=0;i<n-1;i++){
		ll a,b ;
		cin >> a >> b ;
		a-- ; b-- ;
		g.at(a).emplace_back(b) ;
		g.at(b).emplace_back(a) ;
	}
	vll cnt(n,0) ;
	for(int i=0;i<k;i++){
		ll a,b ;
		cin >> a >> b ;
		a-- ;
		cnt.at(a) += b ;
	}
	vll ans(n,-1) ;
	DFS(g,cnt,ans,0,0) ;
	for(int i=0;i<n;i++) cout << ans.at(i) << (i==n-1?'\n':' ') ;
}


Measured memory_bytes: 32128
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;

int main(){
  double n, m, points[1000], sum, elSum;

  while(true){
    sum= 0;
    elSum = 0;
    cin >> n;
    if(n == 0) break;
    for(int i = 0; i < n; i++){
      cin >> points[i];
      sum += points[i];
    }

    m = sum / n;

    for(int i = 0; i < n; i++){
      elSum += pow(points[i] - m, 2);
    }
    cout << fixed << setprecision(6) << sqrt(elSum / n) << endl;
  }

  return 0;
}

Measured memory_bytes: 1284
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>
 
using namespace std;
 
using ll = long long int; 
 
void prime(vector<int> &num, int n){
    for(int i=0;i<=n;i++){
        num[i] = 1;
    }
    num[0] = 0;
    num[1] = 0;
    num[2] = 1;
 
    for(int i=2;i<=sqrt(n);i++){
        if(num[i] == 1){
            for(int j=2;j<=n/i;j++){
                num[i*j] = 0;
            }
        }
    }
}
 
 
ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}
 
ll lcm(ll a, ll b) {
  return a * b / gcd(a, b);
}
 
ll keta(ll a){
  ll ans = 1;
  while(1){
    if(a/10 > 0){
      ans++;
      a = a/10;
    }
    if(a<10) break;
  }
  return ans;
}
 
const int MAX = 50;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
int main(void){
 
    int n, m;
    cin>>n>>m;
    vector<pair<int, int>> p(m);

    for(int i=0;i<m;i++){
      int a, b;
      string c;
      cin>>a;
      cin>>c;
      if(c[0]=='W') b = -1;
      else b = 0;

      p[i] = make_pair(a, b);
    }

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

    for(int i=0;i<m;i++){
      if(piv[p[i].first-1] == 0){
        if(p[i].second == -1) q[p[i].first-1]++;
        else piv[p[i].first-1] = 1;
      }

    }

  ll sum = 0;
  ll num = 0;
    for(int i=0;i<n;i++){
      if(piv[i]!=0){
        sum+=q[i];
        num+=piv[i];
      }
    }

    cout<<num<<" "<<sum<<endl;

    return 0;
}

Measured memory_bytes: 1792