akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <string>
#include <cmath> //abs();
using namespace std;

int main(void)
{
    long long int m,d,a,b,c,k,n,x[10],d1;//ll countだとダメ
    int i,j,count=0;
    vector<int> vec(10);
    array<int,10> ar;
    char C1,C2;
    string s;

    cin >> m >> d;

    for(i=2;i<=9;i++){        
//        if(i*10+j>d) break;
        for(j=2;j<=9;j++){            
            if(i*10+j>d || i*j>m) break;
            count++;
        } 
    }

    cout << count;

    return 0;
}

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

lst = [[0] * 10 for _ in range(10)]

for i in range(1, n + 1):
    s = str(i)
    lst[int(s[0])][int(s[-1])] += 1

ans = 0

for j in range(10):
    for k in range(10):
        ans += lst[j][k] * lst[k][j]

print(ans)

Measured memory_bytes: 3064
#include<stdio.h>

int main()
{
  int n,i,minv,maxv;
  int R[200000];

  scanf("%d",&n);
  for(i = 0;i < n;i++){
    scanf("%d",&R[i]);
  }

  minv = R[0];
  maxv = R[1] - R[0];

  for(i = 1;i < n;i++){
    if(maxv < R[i]-minv) maxv = R[i] - minv;
    if(minv > R[i]) minv = R[i];
  }

  printf("%d\n",maxv);

  return 0;
}

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

int main() {
	int a, b, c;cin >> a >> b >> c;
	int Case[5],ab=abs(a-b),bc=abs(b-c),ca=abs(c-a);
	Case[0] = bc + ca;
	Case[1] = ca + ab;
	Case[2] = ab + bc;
	int min=Case[0];
	if (min > Case[1])min = Case[1];
	if (min > Case[2])min = Case[2];
	if (min > Case[1])min = Case[1];
	cout << min << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <functional>
#include <bits/stdc++.h>


using namespace std;
int n=1000003, status[1000004]= {};

int main()
{
    int x;
    cin>>x;
    if(x<=2)
    {
        cout<<2<<endl;
        return 0;
    }
    else
    {
        int sqrtn=int(sqrt(double(n)));
        for(int i=3; i<sqrtn; i+=2)
        {
            if(status[i]==0)
                for(int j=i*i; j<=n; j+=i+i)
                    status[j]=1;
        }

        x=x%2==0? x+1:x;
        for(int p=x; p<=1000001; p+=2)
            if(!status[p])
            {
                cout<<p<<endl;
                return 0;
            }
    }
}


Measured memory_bytes: 4096
N = int(input())

yaku = []

for i in range(1, N+1):
    if N % i == 0:
        if i in yaku:
            break
        if N/i <= i:
            yaku.append(i)
            break
        yaku.append(i)
        yaku.append(N//i)
    elif N/i < i:
        break

yaku.sort()
ans = str(yaku[len(yaku)//2])
print(len(ans))


Measured memory_bytes: 9176
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-8;
const long long inf=1e16;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
vector<string>in;
int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};
int n,m;
void f(int a,int b,char c){
	in[a][b]='!';
	rep(i,4){
		int nx=a+dx[i];
		int ny=b+dy[i];
		if(nx<0||ny<0||nx>=n||ny>=m)continue;
		if(in[nx][ny]==c)f(nx,ny,c);
	}
}
int main(){
	while(cin>>n>>m,n+m){
		in=vector<string>(n);
		rep(i,n)cin>>in[i];
		int co=0;
		rep(i,n)rep(j,m)if(in[i][j]!='!'){
			co++;
			f(i,j,in[i][j]);
		}
		cout<<co<<endl;
	}
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n + 1);
    vector<int> b(n);
    rep(i, n + 1) cin >> a[i];
    rep(i, n) cin >> b[i];
    long sum = 0;
    ;
    rep(i, n)
    {
        int left = min(a[i], b[i]);
        sum += left;
        a[i] -= left;
        b[i] -= left;
        int right = min(a[i + 1], b[i]);
        sum += right;
        a[i + 1] -= right;
        b[i] -= right;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 int A[200005],B[200005],dp[100005][1],i,n,sum,say,a,b,c,d,e,f,mak,S,g,sum2,x,y,m,j,C[1000005],l,r=-1,D[200005],k,T,say1,say2,say3,I,K,bas,son,mid,t,h ;
 //char s[1000005],ch;
vector<int> v1,v2,v;
string s,s1,s2;
 map<char,int> mp[1005];
double dam;
int main(){

scanf("%d",&n);
for(i=1;i<=n;i++ ){scanf("%d",&A[i] ); dam+= (double)(1.0/(double)A[i] ); }
printf("%.12lf",1/dam);

	return 0;
}

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

#define rep(i, a, n) for (int i = a; i < n; ++i)
#define per(i, a, n) for (int i = n - 1; i >= a; --i)
#define fi first
#define se second

ll N, A, B;

int main()
{
    ios::sync_with_stdio(false);

    while (cin >> N >> A >> B) {
        if (A < B)
            swap(A, B);
        if (((A - B) & 1) == 0) {
            cout << (A - B) / 2 << endl;
        } else {
            ll a1 = min(B - 1, N - A);
            ll a2 = (A - B) / 2 + 1;
            cout << a1 + a2 << endl;
        }
    }
}

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

using ll=long long;
const ll INF=1LL<<60;
const int MOD=1e9+7;

int main(){
    int N; cin >> N;
    string S; cin >> S;
    int Q; cin >> Q;
    vector<set<int>> id(26);
    for(int i=0; i<N; i++){
        id[S[i]-'a'].insert(i);
    }
    while(Q--){
        int t; cin >> t;
        if(t == 1){
            int i; cin >> i;
            i--;
            char c; cin >> c;
            if(c != S[i]){
                id[S[i]-'a'].erase(i);
                id[c-'a'].insert(i);
            }
            S[i]=c;
        }
        else{
            int l, r; cin >> l >> r;
            l--, r--;
            int res=0;
            for(int i=0; i<26; i++){
                if(id[i].empty()) continue;
                auto it=id[i].lower_bound(l);
                if(it == id[i].end()) continue;
                if(*it <= r) res++;
            }
            cout << res << endl;
        }
    }
    return 0;
}

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

using namespace std;

#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second

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

ll modpow(ll a, ll b){

    ll ans=1;
    while(b){
        if(b&1){
            ans=(ans*a)%mod;
        }
        a=(a*a)%mod;
        b=b/2;
    }
    return ans;
}

int inp[1010][1010];
vector<int> mp[2001010];
vector<int> cnt(2001010);

int main(){

    int n;
    cin>>n;


    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n-1; j++) {
            cin>>inp[i][j];
        }
        for(int j = 2; j <= n-1; j++) {

            mp[min(i,inp[i][j-1])*2000+max(inp[i][j-1],i)].pb(min(i,inp[i][j])*2000+max(inp[i][j],i));

            cnt[min(i,inp[i][j])*2000+max(inp[i][j],i)]++;

        }
    }

    queue<int> qq;

    int ans = 1;

    for(int i = 1; i <= n; i++) {
        for(int j = i+1; j <= n; j++) {
            if(cnt[i*2000+j] == 0) {
                qq.push(i*2000+j);
            }
        }
    }

    map<int, int> vis;

    while(!qq.empty()) {
        int pr = qq.front();
        qq.pop();

        int a = pr/2000;
        int b = pr%2000;

        if((vis.find(a) != vis.end()) || (vis.find(b) != vis.end())) {
            ans++;
            vis.clear();
        }

        vis[a] = 1;
        vis[b] = 1;

        for(int i = 0; i < mp[pr].size(); i++) {
            int x = mp[pr][i];
            if(cnt[x] == 1) {
                cnt[x] = 0;
                qq.push(x);
            } else if(cnt[x] > 1) {
                cnt[x]--;
            }
        }
    }

    int fl = 0;

    for(int i = 1; i <= n; i++) {
        for(int j = i+1; j<=n; j++) {
            if(cnt[i*2000+j] != 0) {
                fl = 1;
                break;
            }
        }
    }

    if(fl) {
        cout<<-1<<endl;
    } else cout<<ans<<endl;



    


}


Measured memory_bytes: 74496
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const double EPS = 1e-10;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------


int main()
{
	int n;
	cin >> n;
	int mi = 2000;
	int ma = -1;

	for (int i = 0;i < n;i++) {
		int t;
		cin >> t;
		mi = std::min(mi, t);
		ma = std::max(ma, t);
	}

	cout << ma - mi << endl;
 
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<typename S, typename T>
void xmin(S&a, T const&b){if(b<a) a=b;}
template<typename S, typename T>
void xmax(S&a, T const&b){if(b>a) a=b;}

signed main()
{
    #ifdef LOCAL_RUN
    freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
    int TTT; cin >> TTT; while(TTT--){
    #else
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
    #endif // LOCAL_RUN

    int n;
    cin >> n;
    int last = -1, ans = 0;
    for(int i=0;i<n;++i){
        int x;
        cin >> x;
        if(x == last){
            last = -1;
            ++ans;
        } else {
            last = x;
        }
    }
    cout << ans << "\n";


    #ifdef LOCAL_RUN
    }
    #endif // LOCAL_RUN
    return 0;
}


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

struct Node {
  int num = -1;
  vector<int> next;
  int sum = 0;
};

void recursive(int num, vector<Node>& nodes, int parent, int sum) {
  nodes[num].sum += sum;
  for (int& next : nodes[num].next) {
    if (next == parent) continue;
    recursive(next, nodes, num, nodes[num].sum);
  }
}

int main() {
  int n, q;
  cin >> n >> q;
  vector<pair<int, int>> edges(n - 1);
  for (pair<int, int>& edge : edges) cin >> edge.first >> edge.second;
  vector<Node> nodes(n);
  int num = 0;
  for (Node& node : nodes) {
    nodes[num].num = num;
    num++;
  }
  for (pair<int, int>& edge : edges) {
    nodes[edge.first - 1].next.push_back(edge.second - 1);
    nodes[edge.second - 1].next.push_back(edge.first - 1);
  }
  int p, x;
  for (int i = 0; i < q; ++i) {
    cin >> p >> x;
    nodes[p - 1].sum += x;
  }
  recursive(0, nodes, -1, 0);
  for (Node& node : nodes) cout << node.sum << endl;
  return 0;
}

Measured memory_bytes: 30464
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;
#define fi first
#define se second
map<ll,ll> used;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c*d/gcd(c,d);}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
ll n,k;
cin>>n>>k;
vector<P> a(n);
priority_queue<P> q;
for(int i=0;i<n;i++){
    cin>>a.at(i).fi>>a.at(i).se;
    swap(a.at(i).fi,a.at(i).se);
    q.push(a.at(i));
}
ll ans=0,val=0;
priority_queue<P,vector<P>,greater<P>> tmp;
for(int i=0;i<k;i++){
    P p=q.top();
    q.pop();
if(used[p.se]==0){
val++;
}
used[p.se]++;
ans+=p.fi;
tmp.push(p);
}
ans+=val*val;
ll res=ans;
while(!q.empty()){
      P rem=tmp.top();
      P con=q.top();
      if(tmp.empty())break;
      if(used[rem.se]==1){
          tmp.pop();
          continue;
          }
      q.pop();
      if(used[con.se]>0)continue;
          res=res+(con.fi-rem.fi)+((val+1)*(val+1)-val*val);
          val++;
          used[rem.se]--;
          used[con.se]++;
          tmp.pop();
          tmp.push(con);
          ans=max(ans,res);
}
cout<<ans<<endl;
}


Measured memory_bytes: 8944
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
using P = pair<int, int>;
template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}
int gcd(int a,int b){
    if(a%b==0)return b;
    return gcd(b,a%b);
}
signed main(signed argc, char* argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    const int MOD = 1e9+7;
    int h,w,a,b;
    cin>>h>>w>>a>>b;
    rep(i,h){
        rep(j,w){
            if(j<a==i<b)cout<<0;
            else cout<<1;
        }
        cout<<endl;
    }
}


Measured memory_bytes: 1280
import fractions
import sys
input = sys.stdin.readline


def f(x):
    res = 0
    while x % 2 == 0:
        x /= 2
        res += 1
    return res


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))

    A = list(map(lambda x: x // 2, A))

    t = f(A[0])
    for i in range(len(A)):
        if f(A[i]) != t:
            print(0)
            return 0
        A[i] >>= t
    M >>= t

    l = 1
    for i in range(N):
        l = lcm(l, A[i])
        if l > M:
            print(0)
            return 0

    M /= l
    ans = (M + 1) // 2
    print(int(ans))


if __name__ == "__main__":
    main()


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

int main() {
  
  int X;
  cin >> X;
  
  if (X == 3 || X == 5 || X == 7) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }

return 0;
}

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

namespace Atcoder
{
    class Atcoderrrrrr
    {
        static void Main(string[] args)
        {
            int[] s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int A = s[0];
            int B = s[1];
            string S = Console.ReadLine();
            if (S[A] == '-')
            {
                int cnt = 0;
                for (int i = 0; i < A+B+1; i++)
                {
                    if (S[i]=='-')
                    {
                        cnt++;
                    }
                }
                Console.WriteLine(cnt ==1? "Yes":"No");
            }
            else
            {
                Console.WriteLine("No");
            }

        }
    }
}

Measured memory_bytes: 13268
N, M, X = list(map(int, input().split()))
A = []
for i in range(N):
    a = list(map(int, input().split()))
    A.append(a)


bits = [None] * N
ans = float('inf')

def f():
    global X
    global ans

    cost = 0
    algs = [0] * M
    for i in range(N):
        if bits[i]:
            book = A[i]
            cost += book[0]
            for i in range(1, M+1):
                algs[i-1] += book[i]
    # print(bits, algs, cost)
    p = True
    for ai in algs:
        if ai < X:
            p = False

    if p:
        ans = min(ans, cost)

def dfs(v):
    if v >= N:
        f()
        return

    bits[v] = True
    dfs(v+1)

    bits[v] = False
    dfs(v+1)

dfs(0)

if ans == float('inf'):
    print(-1)
else:
    print(ans)

Measured memory_bytes: 9136
#include <cstdio>
using namespace std;
#define N 3005
int n,m,i,j,pw[N],ni[N],s[N][N];
inline int qmi(int di,int zhi,int Mod)
{
	int ret=1,x=di;
	while (zhi){
		if (zhi&1) ret=1LL*ret*x%Mod;x=1LL*x*x%Mod;zhi>>=1;
	}return ret;
}
int main()
{
	scanf("%d%d",&n,&m);pw[0]=1;
	for (i=1;i<=n;i++) pw[i]=1LL*pw[i-1]*i%m;
	ni[n]=qmi(pw[n],m-2,m);
	for (i=n;i>=1;i--) ni[i-1]=1LL*ni[i]*i%m;
	s[0][0]=1;
	for (i=1;i<=n+1;i++)
	for (j=1;j<=i;j++) s[i][j]=(1LL*j*s[i-1][j]+s[i-1][j-1])%m;
	int ans=0;
	for (i=0;i<=n;i++){
		int gh=qmi(2,qmi(2,n-i,m-1),m);
		for (j=0;j<=i;j++) ans=(1LL*((i&1)?(-1):1)*gh*pw[n]%m*ni[i]%m*ni[n-i]%m*qmi(2,1LL*(n-i)*j%(m-1),m)%m*s[i+1][j+1]+ans)%m;
	}printf("%d\n",(ans+m)%m);
	return 0;
}

Measured memory_bytes: 34176
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5;
int a[3][maxn];
long long s[maxn];

int main() {
	int n;
	scanf("%d", &n);
	for(int i=0; i<3; i++) {
		for(int j=0; j<n; j++)scanf("%d",&a[i][j]);
		a[i][n]=inf;
		sort(a[i],a[i]+n);
	}
	for(int j=0; j<n; j++) {
		int tmp=lower_bound(a[0],a[0]+n,a[1][j])-a[0];
		if(!j)s[j]=(ll)tmp;
		else s[j]=s[j-1]+(ll)tmp;
	}
	ll ans=0;
	for(int j=0;j<n;j++) {
		int tmp=lower_bound(a[1],a[1]+n,a[2][j])-a[1];
		if(tmp)ans+=s[tmp-1];
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 2304
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	int r; cin >> r;
	cout << r * r << endl;
	return 0;
	
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
  int a,b;
  int flag=0;
  scanf("%d",&a);
 
  for(b=0;b<3;b++){
    if(a%10==7){
      flag=1;
    }
    a=a/10;
  }
  if(flag==1)
    printf("Yes");
  else 
    printf("No");
  return 0;
}

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

int main() {
  string s;
  cin >> s;
  ll ans=0;
  for(ll i=0;i<s.size();i++) {
    if(s[i]=='0') {
      ans++;
    }
    else {
      ans--;
    }
  }
  cout << s.size()-abs(ans) << endl;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Convert;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
 			var N = cin.ReadInt;
			var arrC = new int[N - 1];
			var arrS = new int[N - 1];
			var arrF = new int[N - 1];

			for(int i = 0; i < N - 1; i++)
			{
				arrC[i] = cin.ReadInt;
				arrS[i] = cin.ReadInt;
				arrF[i] = cin.ReadInt;
			}

			int[] sum = new int[N];
			for(int i = 0; i < N-1; i++)
			{
				int tmpsum = arrS[i];
				for (int j = i; j < N-1; j++)
				{
					tmpsum += arrC[j];
					if (N - 2<=j)
						break;
					else if (tmpsum < arrS[j + 1])
						tmpsum = arrS[j + 1];
					else
					{
						var over = (tmpsum - arrS[j + 1]) % arrF[j + 1];
						if (0 < over)
							tmpsum += (arrF[j + 1] - over);
					}
				}
				WriteLine(tmpsum);
			}
			WriteLine("0");
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

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

//create arrays outside of main()
int N = 10;
int a[3] = {};


int main() {
    
    string weather;
    cin >> weather;

    if(weather == "Sunny") {
        cout << "Cloudy";
    } 
    else if (weather == "Cloudy") {
        cout << "Rainy";
    } else {
        cout << "Sunny";
    }

    return 0;

}

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

int main() {
  string S, T; cin >> S >> T;
  int N = S.size(), M = T.size();
  int min_s = 10000;
  for (int i = 0; i <= N-M; i++) {
    int c = 0;
    for (int j = 0; j < M; j++) c += (S[i+j] != T[j]);
    min_s = min(min_s, c);
  }
  cout << min_s << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VP = vector<P>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

vector<pair<ll, int>> factorize(ll n){
    vector<pair<ll, int>> res;
    for (ll i = 2; i*i <= n; ++i){
        if (n%i) continue;
        res.emplace_back(i, 0);
        while (n%i == 0){
            n /= i;
            res.back().second++;
        }
    }
    if(n != 1) res.emplace_back(n, 1);
    return res;
}

ll ans;

void dfs(vector<pair<ll, int>> &res, int i, int sz, VI &sels, ll cnt){
    cnt *= sels.back() + 1;
    if (cnt > 75){
        return;
    }
    if (cnt == 75){
        ans++;
        return;
    }
    if (i == sz){
        return;
    } 

    for(int j = 0; j <= res[i].second; j++){
        sels.push_back(j);
        dfs(res, i+1, sz, sels, cnt);
        sels.pop_back();
    }
}

int main(){
    int n;
    cin >> n;
    map<int, ll> mp;
    for(int i = 1; i <= n; i++){
        auto res = factorize(i);
        for(auto r : res){
            mp[r.first] += r.second;
        }
    }
    vector<pair<ll, int>> res;
    for(auto m: mp){
        res.push_back(make_pair(m.first, m.second));
    }

    ans = 0;
    int sz = res.size();
    VI sels(1, 0);
    dfs(res, 0, sz, sels, 1LL);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3580
/**==============================================================*
*            "Bismillahir Rahmanir Raheem"                       *
*        Author          :  Misbah Uddin Tareq.                  *
*        Semester        :  5(C),CSE                             *
*        University      :  Leading University,Sylhet.           *
*===============================================================**/

#include<bits/stdc++.h>
using namespace std;
#define  ll                     long long
#define  pb                     push_back
#define  pii                    pair<int,int>
#define  pll                    pair<ll,ll>
#define  ff                     first
#define  ss                     second
#define  MX                     100005
#define  endl                   "\n"
#define  mod                    1e9+7
#define  pi                     acos(-1.0)
#define  PQ                     priority_queue
#define  mem(a,b)               memset(a, b, sizeof(a))
#define  bug(a)                 cout<<#a<<":"<<a<<endl
#define  all(x)                 (x).begin(),(x).end()
#define  allr(x)                (x).rbegin(),(x).rend()
#define  double_print(x,a)      cout<<fixed<<setprecision(x)<<a<<endl

ll n,k,h[MX],dp[MX];

ll fn(ll idx)
{
    if(idx>=n-1)
        return 0;

    ll &ret=dp[idx];
    if(~ret)
        return ret;
    ret=1e18;
    for(ll i=1; i<=k; i++)
    {
        if(idx+i<=n-1)
            ret=min(ret,abs(h[idx]-h[idx+i])+fn(idx+i));
        else
            break;
    }

    return ret;
}

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

    mem(dp,-1);
    cin>>n>>k;
    for(int i=0; i<n; i++)
        cin>>h[i];

    cout<<fn(0)<<endl;

    return 0;
}


Measured memory_bytes: 11296
x = int(input())
l = []
for i in range(-400,400):
    l.append(i**5)
ans =[]
for i in l:
    for j in l:
        if i - j == x:
            ans.append([i,j])
i,j = ans[0][0],ans[0][1]
print(l.index(i)-400,l.index(j)-400)

Measured memory_bytes: 9076
from functools import lru_cache

z = 0
n = 0
a = 0
b = 0
c = 0
d = 0

@lru_cache(maxsize=None)
def solve(x):
    global a
    global b
    global c
    global d

    if x==0:
        return 0
    if x==1:
        return d

    ans = d*x
    for p in [2,3,5]:
        m = x%p
        nxt = x//p
        A = a
        if p == 3:
            A = b
        if p == 5:
            A = c
        if nxt < x:
            cst = m*d + min(A, (nxt*p-nxt)*d) + solve(nxt)
            ans = min(ans, cst)
        nxt = (x+p-m)//p
        if nxt < x:
            cst = min((p-m)*d + A + solve(nxt), (x-nxt)*d + solve(nxt))
            ans = min(ans, cst)

    #print(x, ans)
    return ans

z = int(input())

for _ in range(z):
    n, a, b, c, d = map(int, input().split())
    print(solve(n))
    solve.cache_clear()

Measured memory_bytes: 100488
//  .:::.   .:::.
// :::::::.:::::::
// :::::::::::::::
// ':::::::::::::'
//   ':::::::::'
//     ':::::'
//       ':'
#include <bits/stdc++.h>
#define rep(i,a,b) for (i=a;i<b;i++)
#define rep2(i,a,b) for (i=a;i>=b;i--)
#define mod 1000000007
#define mod2 998244353
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define INF  1e9+5
#define f first
#define s second
#define endl '\n'
#define ll long long
#define ii pair <int,int>
#define pll pair <ll,ll>
#define vi vector <int>
#define vl vector <ll>
#define vvi vector < vi >
#define vii vector < ii >
#define vpl vector < pll >
#define vvii vector < vii >
#define vll vector < ll >
#define vb  vector <bool>
#define pb push_back
#define mk make_pair
#define pg priority_queue<ll, vector<ll>, greater<ll>>
#define pq priority_queue<ll>
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define cset(a) __builtin_popcountll(a)
#define FILL(a, b, T) fill_n((T *)a, sizeof(a) / sizeof(T), b)
using namespace std;
ll a[100001][3], dp[100001][3];
int main()
{
    FIO;
    ll t, q, maxx, n, k, i, j, k1, k2, k3, x, flag, ans, sum, cnt, prev;
    cin>>n>>k;
    vll v(n), w(n);
    rep(i,0,n)
    {
        cin>>w[i]>>v[i];
    }
    ll dp[k+1];
    memset(dp,0,sizeof(dp));
    rep(i,0,n)
    {
        rep2(j,k,w[i])
        {
            dp[j] = max(dp[j], dp[j - w[i]] + v[i]);
            // dp[j] = max(dp[j], dp[j-1]);
        }
    }
    ans = 0;
    rep(i,0,k+1)
    {
        ans = max(ans, dp[i]);
    }
    cout<<ans<<endl;
    return 0;    
}


Measured memory_bytes: 1024
#include <stdio.h>
#define DEKAI 1000000000
#define N 500000
void merge(int[],int,int,int);
void mergeSort(int[],int,int);
int count=0;
int L[N/2 +2],R[N/2+2];
int main(){
  int A[N],i,n;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
   }
  mergeSort(A,0,n);
  for(i=0;i<n;i++){
    if(i>0)printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
  printf("%d\n",count);
  return 0;
}


void mergeSort(int A[],int left,int right){
  if(left+1<right){
    int mid=(left+right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
  
}
void merge(int A[],int left,int mid,int right){
int k,i,j;

  int n1=mid-left;
  int n2=right-mid;
  for(i=0;i<n1;i++){
    L[i]=A[left+i];
  }
  for(i=0;i<n2;i++){
    R[i]=A[mid +i];
  }
  L[n1]=R[n2]=DEKAI;
  i=0,j=0;
  for(k=left;k<right;k++){
count++;
    if(L[i]<=R[j]){
      A[k]=L[i++];
    }
    else{
      A[k]=R[j++];
    }
  }
  
}



Measured memory_bytes: 5688
#include<stdio.h>

#define N 8
#define FREE 0
#define N_FREE 1

int k;
int R[N],C[N],row[N],col[N];
int dpos[2*N-1],dneg[2*N-1];  /*dpos:右から左への斜め線,dneg:dposの逆*/

void putQueen(int);
void printBoard(void);

int main(){
  int r,c,i;

  scanf("%d",&k);
  for(i=0;i<k;i++){
    scanf("%d%d",&r,&c);
    R[i]=r;
    C[i]=c;
    row[r]=c;
    col[c]=dpos[r+c]=dneg[r-c+N-1]=N_FREE;
  }

  putQueen(0);

  return 0;
}

void putQueen(int i){
  int j,n;

  if(i==N){
    printBoard();
    return;
  }

  for(j=0;j<N;j++){
    /*初期条件で置かれているときの処理*/
    for(n=0;n<k;n++){
      if(R[n]==i && C[n]==j){
	row[i]=j;
	putQueen(i+1);
      }
    }
    
    if(col[j]==N_FREE || dpos[i+j] == N_FREE || dneg[i-j+N-1]==N_FREE) continue;
    
    /*put a queen at (i,j)*/
    row[i]=j;
    col[j]=dpos[i+j]=dneg[i-j+N-1]=N_FREE;

    /*try the next row*/
    putQueen(i+1);
    
    /*remove the queen at (i,j) for backtrabking*/
    col[j]=dpos[i+j]=dneg[i-j+N-1]=FREE;
  }
}

void printBoard(){
  int i,j;

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(row[i]==j) printf("Q");
      else printf(".");
    }
    printf("\n");
  }
}



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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const int MAX = 10000;
static const ll INFTY = 1e12;

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;
// 入力
int H, W;
vector<vector<char>> field;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 深さ優先探索
vector<bool> seen;
vector<int> colors;


int main() {

  string S; cin >> S;

  if(S[0] == S[1] && S[1] == S[2]) cout << "No" << endl;
  else cout << "Yes" << endl;


    
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
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; }
ll inf=1001001001;
ll res=0;

void merge(vector<ll> &a, ll left, ll mid, ll right){
    ll n1=mid-left;
    ll n2=right-mid;
    vector<ll> l(n1+1), r(n2+1);
    rep(i,n1) l[i]=a[left+i];
    rep(i,n2) r[i]=a[mid+i];
    l[n1]=inf; r[n2]=inf;
    ll i=0, j=0;
    for(ll k=left; k<right; k++){
        res++;
        if(l[i]<=r[j]){
            a[k]=l[i];
            i++;
        }else{
            a[k]=r[j];
            j++;
        }
    }
}

void mergeSort(vector<ll> &a, ll left, ll right){
    if(left+1<right){
        ll mid=(left+right)/2;
        mergeSort(a,left,mid);
        mergeSort(a,mid,right);
        merge(a,left,mid,right);
    }
}

int main(){
    ll n; cin>>n;
    vector<ll> s(n);
    rep(i,n) cin>>s[i];
    res=0;
    mergeSort(s,0,n);
    rep(i,n){
        cout<<s[i];
        if(i<n-1) cout<<' ';
        else cout<<endl;
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 10524
#include<stdio.h>

void trace(int r[100], int n)
{
    int i;

    for(i = 0; i < n; i++){

        if(i > 0) printf(" ");

        printf("%d", r[i]);
    }
    printf("\n");
}

int main()
{
    int a,  i,  j, n, r[100];

    scanf("%d", &n);

    for(i = 0; i < n; i++){

        scanf("%d", &r[i]);

    }

    trace(r, n);

    for(i = 1; i < n; i++){

        a = r[i];

        j = i - 1;

        while(j >= 0 && r[j] > a){

            r[j+1] = r[j];

            j --;
        }
            r[j+1] = a;
            trace(r, n);
    }
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    string s;
    vector<long long> num(5);
    for(int i=0; i<n; i++) {
        cin >> s;
        if(s.at(0)=='M') num.at(0)++;
        else if(s.at(0)=='A') num.at(1)++;
        else if(s.at(0)=='R') num.at(2)++;
        else if(s.at(0)=='C') num.at(3)++;
        else if(s.at(0)=='H') num.at(4)++;
    }
    long long ans;
    ans=num.at(0)*num.at(1)*num.at(2) + num.at(0)*num.at(1)*num.at(3) +
    num.at(0)*num.at(1)*num.at(4) + num.at(0)*num.at(2)*num.at(3) + 
    num.at(0)*num.at(2)*num.at(4) + num.at(0)*num.at(3)*num.at(4) +
    num.at(1)*num.at(2)*num.at(3) + num.at(1)*num.at(2)*num.at(4) +
    num.at(1)*num.at(3)*num.at(4) + num.at(2)*num.at(3)*num.at(4);  
    cout << ans;
}

Measured memory_bytes: 256
from itertools import combinations
N,M,X=[int(x) for x in input().split()]
L=[]
for _ in range(N):
  L.append([int(x) for x in input().split()])

Smin=-1
for i in range(N):
  for t in combinations(L,i+1):
    S=0
    A=[0]*M
    for l in t:
      S+=l[0]
      for x in range(M):
        A[x]+=l[1+x]
    ok=True
    for x in range(M):
      if A[x] < X:
        ok=False
        break
    if ok and (Smin==-1 or Smin>S):
      Smin=S
print(Smin)


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

using namespace std;

int main()
{
    int n, m, a, b;
    cin >> n >> m;
    string s;
    cin >> s;
    vector <int> D[n+1], T;
    int S[n+1], A[n+1], B[n+1], G[n+1], k=0;
    for (int i = 1; i <= n; i++)
    {
        if (s[i-1] == 'A')
        {
            S[i] = 0;
        }
        else
        {
            S[i] = 1;
        }
        A[i] = 0;
        B[i] = 0;
        G[i] = 0;
    }
    for (int i = 0; i < m; i++)
    {
        cin >> a >> b;
        D[a].push_back(b);
        D[b].push_back(a);
        if (S[a] == 1)
        {
            B[b]++;
        }
        else
        {
            A[b]++;
        }
        if (S[b] == 1)
        {
            B[a]++;
        }
        else
        {
            A[a]++;
        }
    }
    for (int i = 1; i <= n; i++)
    {
        if (A[i] >= 1 && B[i] >= 1)
        {
            G[i] = 1;
            k++;
        }
        else
        {
            T.push_back(i);
        }
    }
    for (int i = 0; i < T.size(); i++)
    {
        a = T[i];
        for (int y = 0; y < D[a].size(); y++)
        {
            b = D[a][y];
            if (S[a] == 1)
            {
                B[b]--;
            }
            else
            {
                A[b]--;
            }
            if (G[b] == 1 && (A[b] == 0 || B[b] == 0))
            {
                k--;
                G[b] = 0;
                T.push_back(b);
            }
        }
    }
    if (k > 0)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 14336
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a),for_##i##_max=(b);i<=(for_##i##_max);++i)
#define RFOR(i,a,b) for (int i=(a),rfor_##i##_min=(b);i>=(rfor_##i##_min);--i)
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

namespace { // Basics

template<typename T>
void chmin(T &x, T y) {
  x = std::min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
  x = std::max(x, y);
}

template<typename T>
const auto minimum = static_cast<T const &(*)(T const &, T const &)>(std::min);

template<typename T>
const auto maximum = static_cast<T const &(*)(T const &, T const &)>(std::max);

template<typename T>
T constexpr infty = std::numeric_limits<T>::max / 3;
template<>
auto constexpr infty<int> = 1'100'100'100;
template<>
auto constexpr infty<long long int> = 100'500'400'300'200'100LL;

using lli = long long int;
using ld = long double;

} // namespace

using namespace std;

int main() {
  // cout << fixed << setprecision(10);

  int N, M;
  while (cin >> N >> M && N + M > 0) {
    vector<int> vals;
    REP(i, N) {
      int A;
      cin >> A;
      vals.push_back(A);
    }
    int ans = -1;
    REP(i, N) REP(j, N) {
      int price = vals[i]+vals[j];
      if (i == j || price > M) { continue; }
      chmax(ans, price);
    }
    if (ans == -1) {
      cout << "NONE" << endl;
    } else {
      cout << ans << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3108
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long a = Long.parseLong(sc.next());
        long b = Long.parseLong(sc.next());
        int[] x = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = Integer.parseInt(sc.next());
        }
        long ans = 0;
        for (int i = 0; i < n - 1; i++) {
            long sub = x[i + 1] - x[i];
            ans += Math.min(b, sub * a);
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 48116
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()
// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
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); }

//CODE

void solve(void)
{
  int M = 3;
  vector<vector<int> > BINGO(M,vector<int>(M));
  for (int i = 0; i < M; i++)
  {
    for (int j = 0; j < M; j++)
    {
      cin>>BINGO[i][j];
    }
    
  }
  int N;
  cin>>N;
  for (int i = 0; i < N; i++)
  {
    int A;
    cin>>A;
    for (int j = 0; j < M; j++)
    {
      for (int k = 0; k < M; k++)
      {
        if(BINGO[j][k] == A)BINGO[j][k] = -1;
      }
      
    }
    
  }

  bool check = false;
  for (int i = 0; i < M; i++)
  {
    if(BINGO[i][0] == -1 &&BINGO[i][1] == -1 &&BINGO[i][2] == -1 )check = 1;
    if(BINGO[0][i] == -1 &&BINGO[1][i] == -1 &&BINGO[2][i] == -1 )check = 1;
  }
  if(BINGO[0][0] == -1 &&BINGO[1][1] == -1 &&BINGO[2][2] == -1 )check = 1;
  if(BINGO[0][2] == -1 &&BINGO[1][1] == -1 &&BINGO[2][0] == -1 )check = 1;
  
  cout<<(check?"Yes":"No")<<endl;
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


Measured memory_bytes: 256
(defun split-with (string &key (delimiterp #'(lambda (c) (char= c #\Space))))
  (loop :for beg = (position-if-not delimiterp string)
        :then (position-if-not delimiterp string :start (1+ end))
        :for end = (and beg (position-if delimiterp string :start beg))
        :when beg :collect (subseq string beg end)
        :while end))

(let* ((lst (split-with (read-line)))
       (a (parse-integer (car lst)))
       (b (parse-integer (car (cdr lst)))))
  (format t "~d~%" (mod (+ a b) 24)))


Measured memory_bytes: 9316
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<int> a(5);
    vector<int> b;
    int ans=0;
    rep(i,5){
      cin>>a[i];
      ans+=a[i];
      if(a[i]%10!=0){
        b.push_back(10-a[i]%10);
        ans+=10-a[i]%10;
      }
    }
    if(!b.empty()){
      cout<<ans-*max_element(begin(b),end(b))<<endl;
    }else{
      cout<<ans<<endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <memory.h>
#include <vector>

using namespace std;
typedef long long LL;
const int maxn = 100005;

int a[maxn],n;
bool comp(int x,int y) {
	return x>y;
}
int main()
{
	#ifdef Amberframe
		freopen("agc002e.in","r",stdin);
		freopen("agc002e.out","w",stdout);
	#endif
	scanf("%d",&n);a[0]=1<<30;
	for (int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+n+1,comp);
	int p=n-1;while (a[p+1]<=p) --p;
	bool winner=false;
	winner|=a[p+1]-p+1&1;
	int q=p+1;while (a[q+1]>=p+1) ++q;
	winner|=q-p+1&1;
	printf("%s",winner?"First":"Second");
	return 0;
}

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

//#define Fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
typedef vector<int>Vl;
typedef pair<int,int>PII;
typedef vector<PII>Vll;
typedef vector<pair<int,pair<int,int> > >Vlll;
typedef priority_queue<int>PQL;
typedef map<int,int>MP;
#define S second
#define F first
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define sl(n) scanf("%lld",&n)
#define pl(n) printf("%lld",n)
const int mod=1e9+7;
const int maxsum=2502;
int dp[51][maxsum];
int subs(int i,int s,int arr[],int n){
	if(i==n){
		if(s==0)return 1;
		else return 0;
	}
	if(dp[i][s+maxsum]!=-1)return dp[i][s+maxsum];
	return dp[i][s+maxsum]=subs(i+1,s+arr[i],arr,n)+subs(i+1,s,arr,n);
}
signed main(){
  ms(dp,-1);
  int n,avg;
  sl(n);sl(avg);
  int x[n];
  for(int i=0;i<n;i++)sl(x[i]);
  for(int i=0;i<n;i++)x[i]=x[i]-avg;
  cout<<subs(0,0,x,n)-1<<endl;
 
  return 0;
}


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

int main(void)
{

	string s;
	int cnt=0;

			cin >> s;

		for (int i = 0; i < 3; i++)
		{
			if (s[i] == '1') 
			{
				cnt++;
			}
		}

		cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
void hitAndBlow(int *n, int *m)
{
  int a[4], b[4], c[4] = {};
 
  for (int i=0; i<4; i++) {
    a[i] = *n % 10;
    *n /= 10;
    b[i] = *m % 10;
    *m /= 10;
  }
 
  for (int i=0; i<4; i++) {
    if (a[i] == b[i]) {
      (*n)++;
      c[i] = 1;
    }
  }
 
  for (int i=0; i<4; i++) {
    if (c[i]) continue;
    for (int j=0; j<4; j++) {
      if (c[j]) continue;
      if (a[i] == b[j])
    (*m)++;
    }
  }
}
 
int main(void)
{
  while (1) {
    int n,m;
    cin >> n >> m;
    if (!n && !m) break;
    hitAndBlow(&n, &m);
    cout << n << " " << m << endl;
  }
  return 0;
}

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


int main() {
  int N;
  cin >> N;
  int d[110];
  for(int i=0;i<N;++i) cin>>d[i];
  
  int prev = 0;
  int ans=0;
  
  sort(d,d+N);
  
  for(int i=0;i<N;++i){
    if(prev<d[i]) ++ans;
    prev = d[i];
  }
  cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    int N;
    cin >> N;
    ll x[N], y[N];
    rep(i, N){
        ll a, b;
        cin >> a >> b;
        x[i] = a+b, y[i] = a-b;
    }
    bool eve = false, odd = false;
    rep(i, N){
        if((x[i])%2 == 0) eve = true;
        else odd = true;
    }
    if(eve && odd) {cout << -1 << endl; return 0;}
    vector<ll> d;
    if(eve) d.pb(1);
    rep(i, 39) d.pb(1LL<<i);
    ll S = accumulate(all(d), 0LL);
    int m = sz(d);
    cout << m << endl;
    for(auto &e: d) cout << e << ' '; cout << endl;
    char mode[] = {'L', 'D', 'U', 'R'};
    rep(i, N){
        int ans[m];
        fill(ans, ans+m, 0);
        x[i] += S, y[i] += S;
        rep(j, m){
            ll e = d[j]<<1;
            if(x[i]&e) x[i] ^= e, ans[j] ^= 2;
            if(y[i]&e) y[i] ^= e, ans[j] ^= 1;
        }
        rep(j, m) cout << mode[ans[j]];
        cout << endl;
    }
}

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

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

	short p[200000];

	for(int n=0; n<N; n++){
		cin >> p[n];
	}

	uint64_t sum = 0;
	uint64_t summax = 0;

	for(int n=0; n<N; n++){
		if(n < K){
			sum += (p[n] + 1);
			summax = sum;
		} else {
			sum += (p[n] + 1) - (p[n-K] + 1);
			if(summax < sum){
				summax = sum;
			}
		}
	}

	cout << (summax / 2);
	if(summax % 2 != 0){
		cout << ".5";
	}

	return 0;
}


Measured memory_bytes: 640