akhauriyash/Code-Regression huggingface dataset:
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;

int main() {
	int A, B;
	cin >> A >> B;
	if (A <= 8 && B <= 8)puts("Yay!");
	else puts(":(");

	return(0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define answer cout << ans << endl;
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
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; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;


signed _main(){
  int K; cin >> K;
  K--;
  v<string> lunlun;
  for(int i=1;i<=9;i++){
    lunlun.push_back(to_string(i));
  }
  int first=0;
  int last=8;
  while(lunlun.size()<=100000){
    for(int i=first;i<=last;i++){
      string num=lunlun[i];
      int numm=num[num.size()-1]-'0';
      if(numm-1>=0){
        lunlun.push_back(num+to_string(numm-1));
      }
      lunlun.push_back(num+to_string(numm));
      if(numm+1<=9) lunlun.push_back(num+to_string(numm+1));
    }
    first=last+1;
    last=lunlun.size()-1;
  }
  cout << lunlun[K] << endl;

  return 0;
}


Measured memory_bytes: 11268
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
bool chmin(ll& a, ll  b) { if (b < a) { a = b; return 1; } return 0; }
bool chmax(ll& a, ll b) { if (b > a) { a = b; return 1; } return 0; }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
#include <cstdint>                                                                                                              

template <std::uint_fast64_t Modulus> class modint {
	using u64 = std::uint_fast64_t;

public:
	u64 a;

	constexpr modint(const u64 x = 0) noexcept : a(x% Modulus) {}
	constexpr u64& value() noexcept { return a; }
	constexpr const u64& value() const noexcept { return a; }
	constexpr modint operator+(const modint rhs) const noexcept {
		return modint(*this) += rhs;
	}
	constexpr modint operator-(const modint rhs) const noexcept {
		return modint(*this) -= rhs;
	}
	constexpr modint operator*(const modint rhs) const noexcept {
		return modint(*this) *= rhs;
	}
	constexpr modint operator/(const modint rhs) const noexcept {
		return modint(*this) /= rhs;
	}
	constexpr modint& operator+=(const modint rhs) noexcept {
		a += rhs.a;
		if (a >= Modulus) {
			a -= Modulus;
		}
		return *this;
	}
	constexpr modint& operator-=(const modint rhs) noexcept {
		if (a < rhs.a) {
			a += Modulus;
		}
		a -= rhs.a;
		return *this;
	}
	constexpr modint& operator*=(const modint rhs) noexcept {
		a = a * rhs.a % Modulus;
		return *this;
	}
	constexpr modint& operator/=(modint rhs) noexcept {
		u64 exp = Modulus - 2;
		while (exp) {
			if (exp % 2) {
				*this *= rhs;
			}
			rhs *= rhs;
			exp /= 2;
		}
		return *this;
	}
};
ll modpow(ll a, ll n, ll mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1)
			res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
using mint = modint<MOD>;
vector<mint> V;
int main() {
	cin >> n >> a >> b;
	mint X = 1,Y,Z;
	V.push_back(1);
	X = modpow(2, n, MOD);
	rep(i, 300000) {
		V.push_back(V.back() * (i + 1));
	}

	Y = 1;
	Z = 1;
	rep(i, a) {
		Y *= n - i;
	}
	rep(i, b) {
		Z *= n - i;
	}


	cout << (X - Y / V[a] - Z / V[b]-1).a << endl;
}

Measured memory_bytes: 6384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;

int N,K,R,S,P;
int point(char x){
    if(x=='r'){
        return P;
    }else if(x=='s'){
        return R;
    }else if(x=='p'){
        return S;
    }
}

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

    cin >> N >>K>>R >> S >> P;
    string T;
    cin >> T;
    int sum=0;
    rep(i,N){
        if(i<K) sum+=point(T.at(i));
        else if(T.at(i)==T.at(i-K)){
            T.at(i)='q';
        }else{
            sum+=point(T.at(i));
        }
    }
    cout << sum << endl;





}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ll long long
#define MOD 1000000007
#define MAX 1000010
using namespace std;

int main(){
  int h,n;
  cin >> h >> n;
  int a[n];
  REP(i,n) cin >> a[i];
  int sum = 0;
  REP(i,n) sum += a[i];
  
  if(sum >= h) cout << "Yes";
  else cout << "No";
  return 0;
}

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

using namespace std;
typedef long long lli;
const int N = 10;
const int M = 50;
const lli INF = 1LL << 40;

int w, h, f, m, o;
int dat[N][N];
lli dp[N+1][N][1<<N][M+1];

main(){
  while(cin >> w >> h && (w|h)){
    cin >> f >> m >> o;
    for(int i=0;i<h;i++) for(int j=0;j<w;j++) cin >> dat[i][j];
    fill(dp[0][0][0], dp[N+1][0][0], -INF);
    for(int i=0;i<w;i++){
      if(o - 1 > 0){
        if(dat[0][i] >= 0){
          dp[0][i][1<<i][min(m, (o-1+dat[0][i]))] = 0;
        }else if(dat[0][i] < 0){
          if(f + dat[0][i] >= 0)
            dp[0][i][1<<i][o-1] = dat[0][i];
        }
      }
    }
    for(int i=0;i<h-1;i++){
      lli nm, cost;
      for(int j=0;j<(1<<w);j++){ // 2
        for(int k=1;k<=m;k++){
          for(int d=0;d<w;d++){
            int l = w-1, r = 0;
            for(int k2=0;k2<w;k2++){
              if((j >> k2) & 1){
                l = min(l, k2);
                r = max(r, k2);
              }
            }
            if(l > 0 && k - abs(l-d) - 1 > 0){
              if(dat[i][l-1] >= 0){
                nm = min(m, (k - abs(l-d) - 1 + dat[i][l-1]));
                cost = 0;
              }else if(dat[i][l-1] < 0){
                nm = k - abs(l-d) - 1;
                cost = dat[i][l-1];
              }
              if(f + dp[i][d][j][k] + cost >= 0)
                dp[i][l-1][j|(1<<(l-1))][nm] = max(dp[i][l-1][j|(1<<(l-1))][nm], dp[i][d][j][k] + cost);
            }
            if(r + 1 < w && k - abs(r-d) - 1 > 0){
              if(dat[i][r+1] >= 0){
                nm = min(m, (k - abs(r-d) - 1+ dat[i][r+1]));
                cost = 0;
              }else if(dat[i][r+1] < 0){
                nm = k - abs(r-d) - 1;
                cost = dat[i][r+1];
              }
              if(f + dp[i][d][j][k] + cost >= 0)
                dp[i][r+1][j|(1<<(r+1))][nm] = max(dp[i][r+1][j|(1<<(r+1))][nm], dp[i][d][j][k] + cost);
            }
            for(int p=l;p<=r;p++){
              if(k - abs(p-d) - 1 > 0){
                if(dat[i+1][p] >= 0){
                  nm = min(m, (k - abs(p-d) - 1 + dat[i+1][p]));
                  cost = 0;
                }else if(dat[i+1][p] < 0){
                  nm = k - abs(p-d) - 1;
                  cost = dat[i+1][p];
                }
                if(f + dp[i][d][j][k] + cost >= 0)
                  dp[i+1][p][1<<p][nm] = max(dp[i+1][p][1<<p][nm], dp[i][d][j][k] + cost);
              }
            }
          }
        }
      }
    }
    lli valM = -INF;
    for(int j=0;j<(1<<w);j++){
      for(int k=1;k<=m;k++){
        for(int d=0;d<w;d++){
          valM = max(valM, dp[h-1][d][j][k]);
          //cout << d << ' ' << j << ' ' << k << ' ' << dp[2][d][j][k] << endl;
        }
      }
    }
    if(f + valM < 0){
      cout << "NA" << endl;
    }else{
      cout << abs(valM) << endl;
    }
  }
}

Measured memory_bytes: 46040
n = int(input())
s = input()

ans = ["SS", "SW", "WS", "WW"]

for i in range(4):
    for j in range(1, n + 1):
        if s[j - 1] == "o":
            if ans[i][j] == "S":
                if ans[i][j - 1] == "S":
                    ans[i] += "S"
                else:
                    ans[i] += "W"
            else:
                if ans[i][j - 1] == "S":
                    ans[i] += "W"
                else:
                    ans[i] += "S"
        else:
            if ans[i][j] == "S":
                if ans[i][j - 1] == "S":
                    ans[i] += "W"
                else:
                    ans[i] += "S"
            else:
                if ans[i][j - 1] == "S":
                    ans[i] += "S"
                else:
                    ans[i] += "W"

    if ans[i][0] == ans[i][n] and ans[i][1] == ans[i][n + 1]:
        flag = True
    else:
        flag = False

    if flag:
        idx = i
        break

if flag:
    print(ans[idx][1:n + 1])
else:
    print(-1)


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

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

    int n, arr[55];
    cin >> n;
    int resp = 0;
    for (int i=1; i<=n; i++) cin >> arr[i];
    for (int i=1; i<=n; i++){
        for (int j=i+1; j<=n; j++){
            resp += arr[i]*arr[j];
        }
    }
    cout << resp << endl;
}

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

int main(){

    int N, M, X;
    cin >> N >> M >> X;

    vector<int> C(N);
    vector<vector<int>> A(N,vector<int>(M));

    for (int i = 0; i < N; i++) {
        cin >> C.at(i);
        for (int j = 0; j < M; j++) {
            cin >> A.at(i).at(j);
        }
    }

    int ans = 1300000;
    int allPattern = 1<<N;

    for(int bit = 1; bit < allPattern; bit++){
        vector<int> level(M,0);
        int cost = 0;
        for(int i = 0; i < N; i++){
            if(bit&(1<<i)) {
                cost += C[i];
                for(int j = 0; j < M; j++){
                    level[j] += A[i][j];
                }
            }
        }
        bool IsBoundLevel = true;
        for(int i = 0; i < M; i++){
            if(level[i] < X) {
                IsBoundLevel = false;
            }
        }
        if(IsBoundLevel) {
            ans = min(ans,cost);
        }
    }
    if(ans == 1300000) {
        cout << -1 << endl;
    }
    else {
        cout << ans << endl;
    }

}


Measured memory_bytes: 3632
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define PI  3.14159265358979323846
#define M   1000000007
ll fast(ll n,ll a,ll m)
{
    if(n==0)
        return 1;
    else if(n==1)
        return a;
    else
    {
        ll r=fast(n/2,a,m);
        if(n%2==0)
        {
            return (((r%m)*(r%m))%m);
        }
        else
        {
            return (((((r%m)*a)%m)*r)%m);
        }
    }
}
ll lcm(ll a,ll b)
{
    ll p=a*b;
    p/=__gcd(a,b);
    return p;
}
ll solve(ll z,ll p,ll q,ll n)
{
    ll g=n/z;
    if(g<p)
    {
        return -1;
    }
    else
    {
       g-=p;
       if(g%q==0)
       {
           g/=q;
           return (z+g);
       }
       else
       {
           return -1;
       }
    }
}
int main()
{
    int n,m;
    cin>>n>>m;
    map<int,vector<int> > b;
    int pos[m],dt[m];
    int i;
    for(i=0;i<m;i++)
    {
         cin>>pos[i]>>dt[i];
         b[pos[i]].push_back(dt[i]);
    }
    if(n==1)
    {
       if(m==0)
            cout<<0;
       else
       {

           int d=b[1][0],rk=1;
           for(i=0;i<b[1].size();i++)
           {
               if(b[1][i]!=d)
               {
                   rk=0;
                   break;
               }
           }
           if(rk==1)
           {
               cout<<d;
           }
           else
           {
               cout<<-1;
           }
       }
    }
    else
    {
    map<int,vector<int> > ::iterator it;
    int bc[n+1]={0},ok=1;
    for(it=b.begin();it!=b.end();it++)
    {
        int p=it->first;
        int d=b[p][0],rk=1;
        for(int j=0;j<b[p].size();j++)
        {
            if(b[p][j]!=d)
            {
                rk=0;
                break;
            }
        }
        if(rk==0)
        {
            ok=0;
            break;
        }
        else
        {
            bc[p]=d;
        }
    }
    if(ok==1)
    {
        for(i=0;i<m;i++)
        {
            if(pos[i]==1&&dt[i]==0)
            {
                ok=0;
                break;
            }
        }
        if(ok==0)
            cout<<-1;
        else
        {
            if(bc[1]==0)
            {
                bc[1]=1;
            }
            for(i=1;i<=n;i++)
                cout<<bc[i];
        }
    }
    else
    {
        cout<<-1;
    }
    }






}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
	int main(){
		char S[15];
		char T[15];
		int A,B;
		char U[15];
		
		scanf ("%s %s",&S,&T);
		scanf ("%d %d",&A,&B);
		scanf("%s", &U);
		
		if (strcmp(S,U)==0){
			A--;
		}else if (strcmp(T,U)==0){
			B--;
		}
	 printf ("%d %d",A,B);
	return 0;
	}


Measured memory_bytes: 1704
a, b = map(int, input().split())
if a == b:
  for i in range(a):
    print("{}".format(b), end="")
elif a > b:
  for i in range(a):
    print("{}".format(b), end="")
else:
  for i in range(b):
    print("{}".format(a), end="")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
void PDF(int a,int b, int c)
{
    int k,s,t;
    t = a;
    k = b;
    s = c;
    cout << s << " " << t << " " << k <<endl;
}
int main()
{
    int x,y,z;
    cin >> x >> y >> z;;
    PDF(x,y,z);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mp make_pair
using namespace std;
typedef pair<int, int> pii;

int minDist(pii a, pii b){
  if((a.first > b.first && a.second > b.second) || 
     (a.first < b.first && a.second < b.second)){
    int x = a.first - b.first;
    int y = a.second - b.second;
    int m = min(abs(x), abs(y));
    return abs(a.first - b.first) + abs(a.second - b.second) - m;
  }else{
    return abs(a.first - b.first) + abs(a.second - b.second);
  }
}

int main(int argc, char *argv[]){
  int w, h, n;
  cin >> w >> h >> n;
  pii p[n];
  for (int i = 0; i < n; i++) {
    cin >> p[i].first >> p[i].second;
  }
  int ans = 0;
  for (int i = 0; i <  n - 1; i++) {
    ans += minDist(p[i], p[i + 1]);
  }  
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 1164
#include "bits/stdc++.h"
using namespace std;

#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()

using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;

const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

int32_t main() {
    //ios::sync_with_stdio(false); cin.tie(nullptr);
    
    int n;
    cin >> n;
    vector<int> a(n);
    
    int ans = 0, mx = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        mx = max(mx, a[i]);
        if (i > 0) {
            ans += max(0LL, mx - a[i]);
        }
    }
    
    cout << ans;
}



Measured memory_bytes: 4776
#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 1e18
#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;
    vi a(n),b(n);
    rep(i,n)cin>>a[i]>>b[i];
    bool c=false;
    int cnt=0;
    rep(i,n){
        if(a[i]==b[i]){
            cnt++;
            if(cnt>=3)c=true;
        }
        else cnt=0;
    }
    if(c)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

int main()
{
    int M1, N1, M2, N2;

    cin >> M1 >> N1 >> M2 >> N2;

    if (M1 != M2)
    {
        cout << 1 << endl;
    }

    else
    {
        cout << 0 << endl;
    }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace D
{
    public class Program

    {
        public static void Main(string[] args)
        {
            const string FIRST = "first";
            const string SECOND = "second";

            int n = RInt();
            //int[] items = new int[n];
            for (int i = 0 ; i < n ; i++)
            {
                if (RInt() % 2 == 1)
                {
                    Console.WriteLine(FIRST);
                    return;
                }
            }
            Console.WriteLine(SECOND);
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}


Measured memory_bytes: 15184
def main():
    N, x = map(int, input().split())
    A = list(map(int, input().split()))
    A.sort()
    if sum(A) == x:
        print(N)
        return
    ans = 0
    for i in range(N-1):
        a = A[i]
        if a <= x:
            x -= a
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 38256
#include <cstdio>

int main(){
    int N,T;
    scanf("%d %d",&N,&T);
    int cost[N],time[N];
    for (int i = 0; i < N; i++){
        scanf("%d %d",&cost[i],&time[i]);
    }
    int min=__INT_MAX__;
    bool flag=0;
    for (int i = 0; i < N; i++){
        if(time[i]<=T){
            if(cost[i]<min) min=cost[i];
            flag=1;
        }
    }
    if(flag) printf("%d",min);
    else printf("TLE");
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
ll MAX(ll a,ll b,ll c){return max(a,max(b,c));}
ll MIN(ll a,ll b,ll c){return min(a,min(b,c));}
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
int main(){
    int n,r;
    cin >> n >> r;
    int minus = 100 * (10 - min(10,n));
    cout << r + minus << endl;
}

Measured memory_bytes: 256
import java.io._
import java.util.StringTokenizer

import scala.reflect.ClassTag

object Main {
  def main(args: Array[String]): Unit = {
    try {
      val (in, out) =
        if (isOnlineJudge) {
          (
            new FastScanner(new InputStreamReader(System.in)),
            new PrintWriter(System.out)
          )
        } else {
          (
            new FastScanner(new FileReader(new File("src/resource/problem.in"))),
            new PrintWriter(new File("src/resource/problem.out"))
          )
        }
      new Abc154(in, out).solve()
      out.flush()
      out.close()
    } catch {
      case e: IOException => e.printStackTrace()
    }
  }

  private[this] val isOnlineJudge = true

  class FastScanner(val streamReader: InputStreamReader) {
    private[this] val reader = new BufferedReader(streamReader, 32768)
    private[this] var tokenizer: StringTokenizer = _

    @inline private[this] final def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = Integer.parseInt(next())

    def nextLong(): Long = java.lang.Long.parseLong(next())

    def nextChar(): Char = next().charAt(0)

    def ni(): Int = nextInt()

    def nl(): Long = nextLong()

    def nc(): Char = nextChar()

    def ns(): String = next()

    def ns(n: Int): Array[Char] = ns().toCharArray

    def na(n: Int, offset: Int = 0): Array[Int] = map(n)(_ => ni() + offset)

    def na2(n: Int, offset: Int = 0): (Array[Int], Array[Int]) = {
      val A1, A2 = Array.ofDim[Int](n)
      REP(n) { i =>
        A1(i) = ni() + offset
        A2(i) = ni() + offset
      }
      (A1, A2)
    }

    def nm(n: Int, m: Int): Array[Array[Int]] = {
      val A = Array.ofDim[Int](n, m)
      REP(n) { i =>
        REP(m) { j =>
          A(i)(j) = ni()
        }
      }
      A
    }

    def nal(n: Int): Array[Long] = map(n)(_ => nl())

    def nm_c(n: Int, m: Int): Array[Array[Char]] = map(n)(_ => ns(m))
  }

  def REP(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = offset
    val N = n + offset
    while (i < N) {
      f(i);
      i += 1
    }
  }

  def REP_r(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = n - 1 + offset
    while (i >= offset) {
      f(i);
      i -= 1
    }
  }

  def TO(from: Int, to: Int)(f: Int => Unit): Unit = {
    REP(to - from + 1, from)(f)
  }

  def map[@specialized A: ClassTag](n: Int, offset: Int = 0)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    REP(n)(i => res(i) = f(i + offset))
    res
  }

  def sumL(as: Array[Int]): Long = {
    var s = 0L
    REP(as.length)(i => s += as(i))
    s
  }

  def cumSum(as: Array[Int]): Array[Long] = {
    val cum = Array.ofDim[Long](as.length + 1)
    REP(as.length) { i =>
      cum(i + 1) = cum(i) + as(i)
    }
    cum
  }
}

class Abc154(fScanner: Main.FastScanner, out: java.io.PrintWriter) {

  import Main._
  import fScanner._

  def solve(): Unit = {
    val s = ns()
    out.println(0 until s.length map(_ => 'x') mkString(""))
  }
}


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

using namespace std;
typedef long long ll;




ll gcd( ll a, ll b ){
	if ( a < b )
		return gcd( b, a );
	
	int k = a / b;
	if ( a - k * b == 0 )
		return b;
	return gcd( b, a - k * b );
}

class Primes {
public:
	int size;
	vector<int> v, primes;
	Primes(int _size) : size(_size), v(_size,0), primes(){
		int sqrtsize = (int)sqrt((double)_size);
		
		for ( int i = 2; i < size; i++ ){
			if ( v[i] )
				continue;
			primes.push_back(i);
			if ( i <= sqrtsize )
				for ( int j = i*i; j < _size; j+=i )
					v[j] = 1;
		}
	}
	
	// 素因数分解 map<prime,pow>
	map<int,int> factor(ll x){
		map<int,int> m;
		for ( auto it : primes ){
			int prime = it;
			if ( x < prime )
				break;
			
			int count = 0;
			while ( x % prime == 0 ){
				x /= prime;
				count++;
			}
			if ( count )
				m[prime] = count;
		}
		if ( x != 1 )
			m[x] = 1;
		return m;
	}
	
	
	// 素因数分解 vector<pair<prime,pow>>
	vector<pair<int,int>> factorv(ll x){
		auto m = factor( x );
		vector<pair<int,int>> v;
		for ( auto it : m ){
			v.push_back({it.first,it.second});
		}
		return v;
	}
	
	// 全ての約数を求める
	vector<int> divisor( ll x ){
		auto v = factorv( x );
		vector<int> div;
		divisor2( div, v, 0, 1 );
		sort(div.begin(), div.end());
		return div;
	}
	
	int divisor2( vector<int> &div, vector<pair<int,int>> &v, size_t i, int mul ){
		for ( int j = 0; j <= v[i].second; j++ ){
			if ( i == v.size()-1 ){
				div.push_back(mul);
			}
			else {
				divisor2( div, v, i+1, mul );
			}
			mul *= v[i].first;
		}
	}
	
	
};



int main(){
	ll A, B;
	cin >> A >> B;
	
	ll g = gcd(A,B);
	
	Primes p(1000000);
	auto m = p.factor(g);
	
//	for ( auto it : m ){
//		cout << it.first << " " << it.second << endl;
//	}
	
	cout << (m.size()+1) << endl;
	
	return 0;
}



Measured memory_bytes: 4732
while true
  n,x = gets.chomp.split.map(&:to_i)
  exit if n == 0 && x==0
  cnt = 0
  (1..n).to_a.combination(3).to_a.each do |ar|
    if ar[0] + ar[1] + ar[2] == x
    cnt += 1
    end
  end
  puts cnt
end


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int M = 21;
int n, m, c, t, res;
int b[M];
int main() {
    cin >> n >> m >> c;
    for (int i = 0; i < m; ++i) {
        cin >> b[i];
    }
    for (int i = 0; i < n; ++i) {
        int sum = c;
        for (int j = 0; j < m; ++j) {
            cin >> t;
            sum += t * b[j];
        }
        if (sum > 0)
            ++res;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace A_ABC160
{
    class MainClass
    {

        // static int[] s;

        public static void Main(string[] args)
        {
            // s = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);
            string u = ReadLine();
            if(u[2]==u[3]&&u[4]==u[5]){
                WriteLine("Yes");
            }else{
                WriteLine("No");
            }
            
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
int INF = 10000000;
int group(vector<vector<int>> &S, int d){
  int h = S.size() - 1;
  int w = S[0].size() - 1;
  vector<vector<vector<vector<int>>>> dp(h + 1, vector<vector<vector<int>>>(h + 1, vector<vector<int>>(w + 1, vector<int>(w + 1, -INF))));
  for (int height = 0; height <= h; height++){
    for (int width = 0; width <= w; width++){
      for (int y1 = 0; y1 <= h - height; y1++){
        for (int x1 = 0; x1 <= w - width; x1++){
          int y2 = y1 + height;
          int x2 = x1 + width;
          if (S[y2][x2] - S[y2][x1] - S[y1][x2] + S[y1][x1] >= d){
            dp[y1][y2][x1][x2] = 1;
          }
          for (int k = x1 + 1; k < x2; k++){
            dp[y1][y2][x1][x2] = max(dp[y1][y2][x1][x2], dp[y1][y2][x1][k] + dp[y1][y2][k][x2]);
          }
          for (int k = y1 + 1; k < y2; k++){
            dp[y1][y2][x1][x2] = max(dp[y1][y2][x1][x2], dp[y1][k][x1][x2] + dp[k][y2][x1][x2]);
          }
        }
      }
    }
  }
  return dp[0][h][0][w];
}
int main(){
  while (1){
    int h, w, s;
    cin >> h >> w >> s;
    if (h == 0 && w == 0 && s == 0){
      break;
    }
    vector<vector<int>> u(h, vector<int>(w));
    for (int i = 0; i < h; i++){
      for (int j = 0; j < w; j++){
        cin >> u[i][j];
      }
    }
    vector<vector<int>> S(h + 1, vector<int>(w + 1, 0));
    for (int i = 0; i < h; i++){
      for (int j = 0; j < w; j++){
        S[i + 1][j + 1] = u[i][j];
      }
    }
    for (int i = 1; i <= h; i++){
      for (int j = 1; j <= w; j++){
        S[i][j] += S[i][j - 1];
      }
    }
    for (int j = 1; j <= w; j++){
      for (int i = 1; i <= h; i++){
        S[i][j] += S[i - 1][j];
      }
    }
    int d = S[h][w] - s;
    int ans1 = group(S, d);
    int tv = d;
    int fv = S[h][w] + 1;
    while (fv - tv > 1){
      int mid = (tv + fv) / 2;
      if (group(S, mid) == ans1){
        tv = mid;
      } else {
        fv = mid;
      }
    }
    int ans2 = tv - d;
    cout << ans1 << ' ' << ans2 << endl;
  }
}


Measured memory_bytes: 9056
#include <bits/stdc++.h>
using namespace std;
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
// sort(a.begin(), a.end(), std::greater<int>());

/*
std::vector<std::string> split(const std::string &input, char delimiter)
{
    std::istringstream stream(input);

    std::string field;
    std::vector<std::string> result;
    while (std::getline(stream, field, delimiter))
    {
        result.push_back(field);
    }
    return result;
}
*/

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b) cout<<c;
    if(b==c) cout<<a;
    if(a==c) cout<<b;
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//mapを利用した
int main(){
    int count=0;
    int n1;
    cin >> n1;
    vector<int> a(n1);
    map<int, int> m;
    for(int i=0;i<n1;i++){
        cin >> a[i];
        m[a[i]] = 1;
    }
    int n2;
    cin >> n2;
    vector<int> b(n2);
    for(int i=0;i<n2;i++){
        cin >> b[i];
        if(m[b[i]]==1){
            count++;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
#define LOCAL
#pragma region Macros
typedef long long ll;
#define ALL(x) (x).begin(),(x).end()
const long long MOD=1e9+7;
// const long long MOD=998244353;
const int INF=1e9;
const long long IINF=1e18;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
const char dir[4]={'D','R','U','L'};

template<typename T>
istream &operator>>(istream &is,vector<T> &v){
    for (T &x:v) is >> x;
    return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &v){
    for (int i=0;i<v.size();++i){
        os << v[i] << (i+1==v.size()?"": " ");
    }
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const pair<T,U> &p){
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const map<T,U> &m){
    os << '{';
    for (auto itr=m.begin();itr!=m.end();++itr){
        os << '(' << itr->first << ',' << itr->second << ')';
        if (++itr!=m.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os,const set<T> &s){
    os << '{';
    for (auto itr=s.begin();itr!=s.end();++itr){
        os << *itr;
        if (++itr!=s.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}

void debug_out(){cerr << '\n';}
template<class Head,class... Tail>
void debug_out(Head&& head,Tail&&... tail){
    cerr << head;
    if (sizeof...(Tail)>0) cerr << ", ";
    debug_out(move(tail)...);
}
#ifdef LOCAL
#define debug(...) cerr << " ";\
cerr << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << '\n';\
cerr << " ";\
debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<typename T> T gcd(T x,T y){return y!=0?gcd(y,x%y):x;}
template<typename T> T lcm(T x,T y){return x/gcd(x,y)*y;}

template<class T1,class T2> inline bool chmin(T1 &a,T2 b){
    if (a>b){a=b; return true;} return false;
}
template<class T1,class T2> inline bool chmax(T1 &a,T2 b){
    if (a<b){a=b; return true;} return false;
}
#pragma endregion

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    int sum=0;
    for (char c:S) sum+=c-'0';
    cout << (sum%9==0?"Yes":"No") << '\n';
}

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())

void Yes(){
	cout<<"Yay!"<<endl;
}
void No(){
	cout<<":("<<endl;
}

signed main(){

	lli x;
	cin>>x;
	if(x<100){
		cout<<0<<endl;
		return 0;
	}

	lli now = x/100;
	lli n=6;
	for(lli i=1;i<now;i++){
		n+=5;
	}
	if(n>=100){
		cout<<1<<endl;
		return 0;
	}

	lli border = now*100+n;
	//cout<<"x="<<x<<"border="<<border<<endl;
	if(x>=border){
		cout<<0<<endl;
	}
	else{
		cout<<1<<endl;
	}


	return 0;
}

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

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.second == b.second) {
        return a.first.compare(b.first) < 0;
    }
    return a.second > b.second;
}

int main() {
    int N;
    cin >> N;
    map<string, int> m;
    string S;
    for (int i = 0; i < N; i++) {
        cin >> S;
        if (m.count(S)) {
            m[S]++;
        } else {
            m[S] = 1;
        }
    }
    vector<pair<string, int>> v;
    for (auto it = m.begin(); it != m.end(); it++) {
        v.push_back(make_pair(it->first, it->second));
    }
    sort(v.begin(), v.end(), my_compare);
    int t = v[0].second;
    for (int i = 0; i < v.size(); i++) {
        if (v[i].second == t) {
            cout << v[i].first << "\n";
        }
    }
    return 0;
}

Measured memory_bytes: 29236
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    int n;
    cin >> n;
    map<int, int> mp;
    rep(i, n) {
        int a;
        cin >> a;
        mp[a]++;
    }
    
    int ans = 0;
    for (auto m: mp) {
        if (m.second&1) ans++;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8176
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here! 
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n+2];
        array[0] = 0;
        array[n+1] = 0;
        for (int i = 1; i <= n; i++) {
            array[i] = sc.nextInt();
        }
        
        int[] tmp = new int[n+2];
        for (int i = 1; i < n+2; i++) {
            tmp[i] = tmp[i-1] + Math.abs(array[i] - array[i-1]);
        }
        // System.out.println(Arrays.toString(tmp));
        
        int[] cut = new int[n+2];
        for (int i = 1; i <= n; i++) {
            if (array[i-1] <= array[i+1] && array[i+1] <= array[i]) {
                cut[i] = Math.abs(array[i+1] - array[i]) * 2;
            } else if (array[i] <= array[i-1] && array[i-1] <= array[i+1]) {
                cut[i] = Math.abs(array[i-1] - array[i]) * 2;
            } else if (array[i+1] <= array[i-1] && array[i-1] <= array[i]) {
                cut[i] = Math.abs(array[i-1] - array[i]) * 2;
            } else if (array[i] <= array[i+1] && array[i+1] <= array[i-1]) {
                cut[i] = Math.abs(array[i+1] - array[i]) * 2;
            }
        }
        
        for (int i = 1; i <= n; i++) {
            System.out.println(tmp[n+1] - cut[i]);
        }
    }
}

Measured memory_bytes: 65972
loop do
  n, k = gets.split.map(&:to_i)
  
  break if n == 0
  
  s, ans = gets.split.map(&:to_i), "Yes"
  
  n.times do
    b = gets.split.map(&:to_i)
    
    k.times do |i|
      s[i] -= b[i]
      ans = "No" if s[i] < 0
    end
  end
  
  puts ans
end

Measured memory_bytes: 9068
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<stack>
#include<vector>
#include<cmath>
#include<string>
#include<queue>
#include<map>
#include<cstring>
#include<sstream>
#include<vector>
#include<algorithm>
#include<functional>
#include<set>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<time.h>
typedef long long ll;
using namespace std;

int a[100];

int  bubbleSort(int a[],int n) {
	int cnt = 0;
	for (int i = 0; i < n - 1; i++) {
		for (int j = n - 1; j > i; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				cnt++;
			}
		}
	}
	return cnt;
}

int main() {
	//freopen("run.in", "r", stdin);
	//freopen("run.out", "w", stdout);

	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	int ans = bubbleSort(a, n);
	
	cout << a[0];
	for (int i = 1; i < n; i++)
		cout<<' '<< a[i];
	cout << endl;
        cout << ans << endl;


	return 0;

}

Measured memory_bytes: 3080
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.StringTokenizer;

class Main {
    private static InputReader in;
    private static PrintWriter out;

    // static String convert(String input){
    //     int lgt = input.length();
    //     char last = input.charAt(lgt-1);
    //     if(last == 's'){
    //         return input + "es";
    //     }else{
    //         return input + "s";
    //     }
            
    // }

    static String isInRow(List<Integer> lst){
        int lgt = lst.size();
        int temp3 = 0;
        for(int i =0; i < lgt-2; i++){
            temp3 = lst.get(i);
            if((temp3 != 0) && (lst.get(i+1) != 0) && (lst.get(i+2) != 0) )
                return "Yes";
        }
        return "No";
    }

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        in = new InputReader(inputStream);
        OutputStream outputStream = System.out;
        out = new PrintWriter(outputStream);

        int length = in.nextInt();
        List<Integer> arr = new ArrayList<Integer>();
        List<Integer> arr2 = new ArrayList<Integer>();
        int counter = 0;
        int temp = 0;
        while(counter < length * 2){
            temp = in.nextInt();
            arr.add(temp);
            counter++;
        }
        // System.out.println(arr);

        int temp2 = 0;
        for(int i = 0; i < length; i++){
            temp2 = arr.get(i*2);
            if(temp2 == arr.get(i*2+1)){
                arr2.add(temp2);
            }
            else{
                arr2.add(0);
            }
        }
        System.out.println(isInRow(arr2));
            
        }

    // taken from https://codeforces.com/submissions/Petr
    // together with PrintWriter, these input-output (IO) is much faster than the usual Scanner(System.in) and System.out
    // please use these classes to avoid your fast algorithm gets Time Limit Exceeded caused by slow input-output (IO)
    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: 32880
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      int x=sc.nextInt();//対象者
      int a=sc.nextInt();//X新聞購読者
      int b=sc.nextInt();//Y新聞購読者
      int c=a+b;//X新聞とY新聞の購読者合計
      int d=0;
      int g=0;
      
      if(a>b){
      
        if(x>=c){
        g=0; 
          System.out.println(b+" "+g);
      }else{
          
          if(x==a){
          System.out.println(b+" "+b);
          }else{
             d=c-x;
        System.out.println(b+" "+d);
          }
       
      }
        
      }else if(b>a){
        
        if(x>=c){
        g=0;
          System.out.println(a+" "+g);
      }else{
          
          if(x==b){
          System.out.println(a+" "+a);
          }else{
             d=c-x;
          System.out.println(a+" "+d);
          }
        
      }
        
      }else{
        
        if(a==b && a==x && b==x){
          System.out.println(a+" "+b);
      	}else{
          
          if(c<x){
            g=0;
           System.out.println(a+" "+g); 
          }else{
            g=c-x; 
          System.out.println(a+" "+g);
          }
           
        }
        
      }
      
		
	}
}

Measured memory_bytes: 21716
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<double, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size
#define EPS (1e-10)

void add_mod(ll &a, ll b){
	a += b;
	a %= MOD;
}

void mul_mod(ll &a, ll b){
	a *= b;
	a %= MOD;
}

int main(void){
	int n,m,i,j,k,r,b;
	char d[2][20];
	ll dp[20][20],ans=0ll;
	string s;
	cin >> n;
	cin >> s;
	m = (1<<n);
	for(i=0; i<m; ++i){
		r = 0; b = 0;
		for(j=0; j<n; ++j){
			if((i&(1<<j))){
				d[0][r] = s[j];
				++r;
			}else{
				d[1][b] = s[j];
				++b;
			}
		}
		fill(dp[0],dp[20],0ll);
		dp[r][b] = 1ll;
		for(j=r; j>=0; --j){
			for(k=b; k>=0; --k){
				if(j > 0 && s[n+j+k-1] == d[0][r-j]){
					dp[j-1][k] += dp[j][k];
				}
				if(k > 0 && s[n+j+k-1] == d[1][b-k]){
					dp[j][k-1] += dp[j][k];
				}
			}
		}
		ans += dp[0][0];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
   
    //変数：与えられた数「 x 」と置く
    string x;
    
    while(1){
        //入力：与えられた数「 x 」を入力する
        cin >> x;
        //変数：各桁の和「 trussSum 」と置く
        int trussSum = 0;
        //判定：文字列が０なら終了
        if( x[0] == '0') break;
        
        for(int i = 0; i < x.length(); i++){
            //計算：アスキーコードで引くことで各桁の合計値を求めている。
            trussSum += x[i] - '0'; 
        }
        
        //出力:各桁の和「 trussSum 」を出力する
        cout << trussSum << endl;
        
    }
    
    return 0;
}


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

int main() {
	int n,a[123];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int max = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i+1; j < n; j++) {
			if (a[i] - a[j] > max) {
				max = a[i] - a[j];
			}
			else if (a[j] - a[i] > max) {
				max = a[j] - a[i];
			}
		}
	}
	cout << max;
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long int
#define fr for(ll i=0;i<n;++i)
#define in(a,n) ll a[n];for(ll i=0;i<n;i++)cin>>a[i];
#define print(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<' ';br
#define printv(v) vector<ll> :: iterator it;for(it=v.begin();it!=v.end();it++)cout<<*it<<' ';br
#define print2(a,b) cout<<a<<' '<<b;br
#define print3(a,b,c) cout<<a<<' '<<b<<' '<<c;br
#define sum(a,n) ll sum=0;for(ll i=0;i<n;i++)sum+=a[i];
#define br cout<<endl;
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ff first
#define ss second
#define mod 1000000007
using namespace std;
int main()	{
	SPEED
	ll n,m,x; 
	cin >> n >> x;
	in(a,n)
	ll* dp = new ll [n + 1];
	dp[0] = 0;
	dp[1] = abs(a[1] - a[0]);
	for(ll i = 2; i < n; i++) {
		ll ans = INT_MAX;
		for(ll j = 1; j <= x && i-j>=0;j++) {
			ans = min(ans, dp[i-j] + abs(a[i] - a[i-j]));
		}
		dp[i] = ans;
		//cout << dp[i] <<" ";
	}
	cout << dp[n-1];
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<vector>
#include<queue>
#include<set>
#include<algorithm>
const int N = 1e9;
using namespace std;
#define INF 0x3f3f3f3f
#define mod 1000000009
#define e  2.718281828459045
#define PI acos(-1)
#define lowbit(x) (x&(-x))
#define read(x) scanf("%d",&x)
#define put(x) printf("%d\n",x)
#define memset(x,y) memset(x,y,sizeof(x))
#define ll long long

int main(){
	int cnt=0;
	string s;
	cin>>s;
	for(int i=0;i<s.size()/2;i++){
		if(s[i]!=s[s.size()-i-1])
			cnt++;
	}
	cout<<cnt<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,k,a[100000];
  int ans=0,i;
  scanf("%d %d",&n,&k);
  for(i=0;i<n;i++) scanf("%d", &a[i]);

  while(n>1){
    n=n-k+1;
    ans++;
  }

  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include <string.h>
#include <math.h>

int main(){
	char S[6],T[8],U[6];
	scanf("%5s",S);
	scanf("%*c");
	scanf("%7s",T);
	scanf("%*c");
	scanf("%5s",U);
	
	printf("%s %s %s\n",S,T,U);
	
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>
#include<bits/stdc++.h>
#include<queue>
#include<set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define INF bit(60)
#define pb push_back
#define mod 1000000007

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

using namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


#define FACSIZE 2002

ll invfac[FACSIZE];
ll fac[FACSIZE];

ll mod_pow(ll ,ll );
ll mod_add(ll ,ll );
ll mod_mul(ll ,ll );
ll mod_div(ll ,ll );
void make_fact(ll );
void make_invfact(ll );



int main(void){

  ll n;
  cin>>n;
  string s;
  cin>>s;
  char prev=-1;
  ll ans=0;
  for(auto c:s){
    if(prev==-1) ans++;
    else{
      if(prev!=c) ans++;
    }
    prev=c;
  }

  cout << ans << endl;

  return 0;

}

ll mod_pow(ll x,ll r){
  if(r==0) return 1;
  else if(r==1) return x%mod;
  else if(r%2==0){
    ll t=mod_pow(x,r/2)%mod;
    return t*t %mod;
  } 
  else{
    ll t=mod_pow(x,r/2)%mod;
    ll k= t*t %mod;
    return k*x%mod;
  } 
}
ll mod_add(ll a,ll b){
  return (a+b)%mod;
}

ll mod_mul(ll a,ll b){
  return (a*b)%mod;
}

ll mod_div(ll a,ll b){
  return mod_mul(a,mod_pow(b,mod-2));
}

void make_fact(ll n){
  fac[0]=1;
  rep(i,n){
    fac[i+1]=mod_mul(fac[i],i+1);
  }  
}

void make_invfact(ll n){
  invfac[n]= mod_pow( fac[n] ,mod-2);
  for(int i=n-1;i>=0;i--){
    invfac[i]=mod_mul(invfac[i+1],i+1);
  }

}

Measured memory_bytes: 512