akhauriyash/Code-Regression huggingface dataset:
/*author* Priyanshu Shrivastav (from IIT Palakkad) *
 * *_ __ ___  _ ______ ___  _ ____   ___  ___| |_  *
 * | '_ ` _ \| '__/ __/ _ \| '_ \ \ / / |/ __| __| *
 * | | | | | | | | (_| (_) | | | \ V /| | (__| |_  *
 * |_| |_| |_|_|(_)___\___/|_| |_|\_/ |_|\___|\__| *
When I wrote this, only God and I understood what I was doing
 ** * * * * * * * Now, only God knows * * * * * * */
#include         <bits/stdc++.h>
using namespace std;
#pragma GCC      optimize ("Ofast")
#pragma GCC      optimize ("unroll-loops")
#pragma GCC      target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define IOS      ios_base::sync_with_stdio(false); cin.tie (nullptr)
#define PREC     cout.precision (10); cout << fixed
#define bg(x)    " [ " << #x << " : " << (x) << " ] "
#define x        first
#define y        second
using ll = long long;
using ff = long double;
using pii = pair<int,int>;

#define debug(args...) { \
/* WARNING : do NOT compile this debug func calls with following flags: // \
 * // -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -D_FORTIFY_SOURCE=2*/ \
   string _s = #args; replace(_s.begin(), _s.end(), ',', ' ');\
   stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); \
}
void err(istream_iterator<string> it) { it->empty();
   cerr << " (Line : " << __LINE__ << ")" << '\n';
}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << fixed << setprecision(15) << " [ " <<  *it << " : " << a  << " ] "<< ' ';
	err(++it, args...);
}


const int N = 104, W = (int)1e5 + 10;
ll dp[N][W], val[N], w[N];
int n, cap;

void solve() {
   for (int i = 0; i <= n; ++i) dp[i][0] = 0;
   for (int j = 0; j <= cap; ++j) dp[0][j] = 0;

   for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= cap; ++j) {
         dp[i][j] = dp[i-1][j];
         if (j >= w[i]) dp[i][j] = max(dp[i][j], dp[i-1][j-w[i]] + val[i]);
      }
   }

   cout << dp[n][cap] << "\n";
}

signed main() {
   IOS; PREC;
   cin >> n >> cap;
   for (int i = 1; i <= n; ++i) cin >> w[i] >> val[i];
   solve();

   return EXIT_SUCCESS;
}


Measured memory_bytes: 80128
import sys
sys.setrecursionlimit(10**5)
N,M,Q=map(int,input().split())
a=[0]*(Q)
b=[0]*(Q)
c=[0]*(Q)
d=[0]*(Q)
for i in range(Q):
    A,B,C,D=map(int,input().split())
    a[i]=A;b[i]=B;c[i]=C;d[i]=D
r=[]
def dfs(i,depth,b,h):
    if depth==0:
        b.append(h)
        return
    for j in range(i,M+1):
        nh=h[:]
        nh.append(j)
        dfs(j,depth-1,b,nh)
dfs(1,10,r,[])
ans=0
for R in r:
    cnt=0
    for j in range(Q):
        if R[b[j]-1]-R[a[j]-1]==c[j]:
            cnt+=d[j]
    ans=max(cnt,ans)
print(ans)

Measured memory_bytes: 28668
#include<iostream>
using namespace std;
int main(){
int x[4], y[4];
cin >> x[0] >> y[0] >> x[1] >> y[1];

int a = x[1] - x[0];
int b = y[0] - y[1];
cout << x[1] + b << ' ';
cout << y[1] + a << ' ';
cout << x[1] + b - a << ' ';
cout << y[1] + a + b;
return 0;
}

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

int main(){
  int x, y, z;
  int num;
  scanf("%d %d %d", &x, &y, &z);
  num = (x-z)/(y+z);
  printf("%d\n",num);
  return 0;
}


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

int main(void)
{
    int N;

    cin >> N;

    vector<int> A(N,0);

    for(int i = 0; i < N; ++i)
    {
        int tmp;
        cin >> tmp;
        A[i] = tmp;
    }

    sort(A.begin(), A.end(), std::greater<int>());

    if(N == 2)
    {
        cout << A[0] << endl;
        return 0;
    }

    long long int ans = 0;
    int nn = N;
    std::queue<int> que;

    ans += 0;
    ans += A[0];
    nn -= 2;
    que.push(A[1]);
    que.push(A[1]);

    for(int i = 2; nn > 0; ++i)
    {
        ans += que.front();
        que.pop();
        que.push(A[i]);
        que.push(A[i]);
        --nn;
    }

    cout << ans << endl;

    

    return 0;
}



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

using namespace std;

typedef long long ll;
typedef long double ld;

const ll N=(ll)1e5+7;

ll n;
ll a[N];
ll b[N];

int32_t main()
{
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        cin>>n;
        for(ll i=1;i<=n;i++) cin>>a[i];
        for(ll i=1;i<=n;i++) cin>>b[i];
        vector<ll>kek;
        for(ll i=1;i<=n;i++)
        {
                if(a[i]>b[i])
                {
                        kek.push_back(a[i]-b[i]);
                }
        }
        sort(kek.rbegin(),kek.rend());
        vector<bool>used(kek.size());
        ll p=0;
        ll up=0;
        for(ll i=1;i<=n;i++)
        {
                if(a[i]<b[i])
                {
                        up++;
                        ll need=b[i]-a[i];
                        while(need)
                        {
                                if(p>=kek.size())
                                {
                                        cout<<"-1\n";
                                        return 0;
                                }
                                ll t=min(need,kek[p]);
                                need-=t;
                                kek[p]-=t;
                                used[p]=1;
                                if(kek[p]==0)
                                {
                                        p++;
                                }
                        }
                }
        }
        ll res=up;
        for(ll i=0;i<used.size();i++)
        {
                res+=used[i];
        }
        cout<<res<<"\n";
        return 0;
}
/**


**/


Measured memory_bytes: 2428
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) a.begin(),a.end()
#define lb(s,x) lower_bound(all(s),x)-s.begin()

int main(void){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n)cin>>a[i];
    sort(all(a));
    int mx = a.back();
    int pos = lb(a,mx/2);
    int mid;
    if(pos==0){
        mid = a[0];
    }else if(pos == n-1){
        mid = a[n-2];
    }else{
        int l = a[pos-1], r = a[pos];
        if(abs(mx/2-l) < abs(mx/2-r)){
            mid = l;
        }else{
            mid = r;
        }
    }
    printf("%d %d\n",mx, mid);
    return 0;
}


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

int main(){
	while(1){
		int m,n;
		cin>>m>>n;
		if(n==0&&m==0)break;
		vector<bool> so(7368792,true);
		int i;
		int ans=0;
		for(i=m;i<7368792;i++){
			if(so[i]){
				for(int j=i*2;j<7368792;j+=i)so[j]=false;
				ans++;
				//cout<<i<<endl;
			}
			if(ans>n)break;
		}
		cout<<i<<endl;
	}
	return 0;
}

Measured memory_bytes: 3964
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rp(i,n) for (int i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define all_acc(x) (x).begin(), (x).end(), 0LL
#define int long long
#define absSort(v) sort(a.begin(), a.end(), [](int i, int j) -> bool { return abs(i) < abs(j); });
using namespace std;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
using ll = long long;
double pi=3.14159265359;

//出力するよ
void output_tate(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        //if (i != 0)
        //    cout << " ";
        cout << s[i]<<endl;
    }
    //cout << endl;
}

void output_yoko(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        if (i != 0)
            cout << " ";
        cout << s[i];//<<endl;
    }
    cout << endl;
}

int MOD = pow(10, 9) + 7;

int kaijou(int n){
    if(n==0) return 1;
    else{
        return ((n%MOD)*(kaijou(n-1)%MOD))%MOD;
    }
}

bool ispow(int n){
    int rn=sqrt(n);
    if(rn*rn==n) return true;
    else return false;
}

map<int,int> soinsu;

void soinsuu(int n){
    vector<pair<int,int>> ret;
    for(int i=2;i*i<=n;i++){
        if(n%i !=0) continue;
        int ex=0;
        while(n%i ==0){
            ex++;
            n /= i; //n変更することで、それ以降の約数で割り切れることはない
        }
        ret.push_back(make_pair(i,ex));
    }
    //nが素数だった場合
    if(n!=1) ret.push_back(make_pair(n,1));

    for(auto p:ret){
        int i=p.first;
        int num=p.second;
        soinsu[i]+=num;
    }
}


signed main() {
    int x; cin>>x;

    int cnt=0;

    while(x>=400){
        cnt++;
        x-=200;
    }

    cout<<9-cnt<<endl;
}


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

int main(){
  string a;
  cin >> a;
  int b=0,c=0;
  for(int i=0;i<4;i++){
    if(a.at(i)=='+')b++;
    else c++;
  }
  cout << b-c;
}


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

int main(){
    string s;
    cin >> s;
    size_t size = s.size();
    bool a = true,b = true , c=true;
    for(int i=0;i<size/2;i++){
        if(s[i]!=s[size-i-1]){
            a=false;
            break;
        }
    }
    for(int i=0;i<size/4;i++){
        if(s[i]!=s[size/2 -i-1]){
            b=false;
            break;
        }
    }
    for(int i=0;i<size/4;i++){
        if(s[size/2+1+i]!=s[size-i-1]){
            c=false;
            break;
        }
    }
    if(a==true&&b==true&&c==true){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

int64_t f(int64_t n) {
  if(n<2){
    return 1;
  }
  else{
    return n*f(n-2);
  }
}

int main() {
  int64_t N;
  cin >> N;
  
  if(N==0 || N==1 || N%2==1){
    cout << 0 << endl;
    return 0;
  }
  int64_t ans=0;
  int64_t i=1;
  while(N>=pow(5,i)){
    int64_t p_5=1;
    for(int j=0; j<i; j++){
      p_5*=5;
    }
    ans += N/(p_5*2);
    i++;
    //cout <<i << endl;
  }
  //cout << i << endl;
  //cout << pow(5,i-1)*2<<endl;
  cout << ans << endl;
}

// int型の2次元配列(3×4要素の)の宣言
  //vector<vector<int>> data(3, vector<int>(4));

  // 入力 (2重ループを用いる)
  //for (int i = 0; i < 3; i++) {
    //for (int j = 0; j < 4; j++) {
      //cin >> data.at(i).at(j);
    //}
  //}

Measured memory_bytes: 512
#include<cstdio>
#include<algorithm>
using namespace std;

int n, k, c[10], d[10000];

int main() {
  while (scanf("%d%d", &n, &k), n) {
    for (int i = 0; i < n; i++) scanf("%d", &c[i]);
    int now[4], counter = 0;
    for (int i = 0; i < n; i++) {
      now[0] = c[i];
      for (int j = 0; j < n; j++) {
        if (i == j) continue;
        if (c[j] < 10) now[1] = now[0] * 10 + c[j];
        else now[1] = now[0] * 100 + c[j];
        if (k == 2) {
          d[counter++] = now[1];
          continue;
        }
        for (int x = 0; x < n; x++) {
          if (x == i || x == j) continue;
          if (c[x] < 10) now[2] = now[1] * 10 + c[x];
          else now[2] = now[1] * 100 + c[x];
          if (k == 3) {
            d[counter++] = now[2];
            continue;
          }
          for (int y = 0; y < n; y++) {
            if (y == i || y == j || y == x) continue;
            if (c[y] < 10) now[3] = now[2] * 10 + c[y];
            else now[3] = now[2] * 100 + c[y];
            d[counter++] = now[3];
          }
        }
      }
    }
    sort(d, d+counter);
    int ans = counter;
    for (int i = 0; i < counter - 1; i++) if (d[i] == d[i+1]) ans--;
    printf("%d\n", ans);
  }
}



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



namespace Test1 {

    class ClassMain {


        public static void Main(String[] args) {
            string line;
            bool blflag = false; 
            while ((line = Console.ReadLine()) != null) {
                int n = int.Parse(line);
                if (n == 0) { break; }
                if (blflag) { Console.WriteLine(); }
                blflag = true;
                team[] teams = new team[n];
                for (int i = 0; i < n; i++) {
                    string[] strs = Console.ReadLine().Split(' ');
                    string name = strs[0];
                    int w = int.Parse(strs[1]);
                    int d = int.Parse(strs[3]);
                    int score = 3 * w + d;
                    team t = new team();
                    t.name = name;
                    t.score = score;
                    teams[i] = t;
                }
                //bubble sort.
                for (int i = n-1; i >= 1; i--) {
                    for (int j = 0; j < i; j++) {
                        if (teams[j].score < teams[j + 1].score) {
                            team tmp = teams[j];
                            teams[j] = teams[j + 1];
                            teams[j + 1] = tmp;
                        }
                    }
                }
                //print
                for (int i = 0; i < n; i++) {
                    Console.WriteLine(teams[i].name + "," + teams[i].score);
                }
            }
        }


    }

    class team {
        public string name;
        public int score;
    }
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<char, ll> pcl;

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(mp(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
#define mp make_pair
#define pb push_back
#define INF (1 << 29)
const int mod = 1000000007;

int main() {
    ll A, B, C, K;
    ll max = 0;
    cin >> A >> B >> C >> K;

    if(A != 0) {
        if(K > A) {
            max += A;
            K = K - A;
        } else {
            max += K;
            cout << max << endl;
            exit(0);
        }
    }

    if(B != 0) {
        if(K > B) {
            K = K - B;
        } else {
            cout << max << endl;
            exit(0);
        }
    }

    if(C != 0) {
        if(K > C) {
            max -= C;
        } else {
            max -= K;
            cout << max << endl;
            exit(0);
        }
    }

    cout << max << endl;

    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <limits>
#include <string>
#include <bitset>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n); i > 0; i--)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
using namespace std;
using lint = long long;
using P = pair<int, int>;
using V = vector<int>;
constexpr int MOD = 1e9 + 7;

// int A, B, C, F, H, I, J, K, L, M, N, S, T, U, W;
lint A, B, F, H, I, J, K, L, M, N, S, T, U, W;
// string A, B;
lint ans = 0;
// string ans;
vector<lint> a;

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

	cin >> N;
	a.resize(N);
	for (auto &i : a) cin >> i;

	rep(i, 60) {
		lint odd = 0, even = 0;
		for (auto j : a) {
			if ((j >> i) & 1) odd++;
			else even++;
		}
		K = 1LL << i;
		K %= MOD;
		K *= (odd*even) % MOD;
		ans += K;
		ans %= MOD;
	}

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

Measured memory_bytes: 2560
class Node:
    def __init__(self, key):
        self.parent = None
        self.right = None
        self.left = None
        self.key = key

def insert(root, z):
    y = None
    x = None
    if root != None:
        x = root
        
    while x != None:
        y = x
        if z.key < x.key:
            x = x.left
        else:
            x = x.right
            
    z.parent = y
    if y == None:
        root = z
    elif z.key < y.key:
        y.left = z
    else:
        y.right = z

def find(x, k):
    while x != None and k != x.key:
        if k < x.key:
            x = x.left
        else:
            x = x.right
    return x

def printInOrder(z):
    if z == None:
        return
    if z.left != None:
        printInOrder(z.left)
    inorder.append(str(z.key))
    #print(z.key, end = " ")
    if z.right != None:
        printInOrder(z.right)
        
def printPreOrder(z):
    if z == None:
        return
    #print(z.key, end = " ")
    preorder.append(str(z.key))
    if z.left != None:
        printPreOrder(z.left)
    if z.right != None:
        printPreOrder(z.right)

root = None


n = int(input())
for i in range(n):
    command = input()
    if command[0] == "i":
        com,num = command.split()
        z = Node(int(num))
        insert(root, z)
        if root == None:
            root = z
    elif command[0] == "f":
        com,num = command.split()
        z = Node(int(num))
        x = find(root, int(z.key))
        if x != None:
            print("yes")
        else:
            print("no")

    else:
        inorder = []
        printInOrder(root)
        print(" ", end = "")
        print(' '.join(inorder))
        preorder = []
        printPreOrder(root)
        print(" ", end = "")
        print(' '.join(preorder))







Measured memory_bytes: 148688
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int n, m;
  cin >> n >> m;
  int k = (n - 1) / 2;
  vector<pair<int, int>> ans;
  for (int i = (k + 1) / 2 * 2 - 1, j = 1; i >= 1; i -= 2, j++) {
    ans.emplace_back(j, j + i);
  }
  for (int i = k / 2 * 2, j = n; i >= 2; i -= 2, j--) {
    ans.emplace_back(j, j - i);
  }
  for (int i = 0; i < m; i++) {
    cout << ans[i].first << " " << ans[i].second << '\n';
  }
  return 0;
}

Measured memory_bytes: 4232
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int n, a, b, c;
vi l;
int ans = INF;

void rec(int i, int la, int lb, int lc, int mp) {
  if (i == n) {
    if (la == 0 || lb == 0 || lc == 0) return;
    mp += abs(a-la) + abs(b-lb) + abs(c-lc) - 30;
    ans = min(ans, mp);
    return;
  }
  rec(i+1, la+l[i], lb, lc, mp+10);
  rec(i+1, la, lb+l[i], lc, mp+10);
  rec(i+1, la, lb, lc+l[i], mp+10);
  rec(i+1, la, lb, lc, mp);
  return;
}

int main () {
  cin >> n >> a >> b >> c;
  l = vi(n);
  rep(i,n) cin >> l[i];
  rec(0,0,0,0,0);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define rep(i, x, y) for(int i = (x); i <= (y); i ++)
inline int read() {
	char ch = getchar(); int x = 0, f = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-') f = -1;
		ch = getchar();
	} while('0' <= ch && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	} return x * f;
}
vector<int> ev;
int a[100010];
int main() {
	int n = read(), m = read();
	rep(i, 1, m) a[i] = read();
	rep(i, 1, m) if(a[i] & 1) ev.pb(i);
	if(ev.size() > 2) {
		return puts("Impossible"), 0;
	} if(m == 1) {
		if(a[1] == 1) {
			printf("1\n1\n1\n");
			return 0;
		} printf("%d\n", a[1]);
		puts("2"); printf("%d 1\n", a[1] - 1);
		return 0;
	} if(ev.size() >= 1) swap(a[1], a[ev[0]]);
	if(ev.size() >= 2) swap(a[m], a[ev[1]]);
	rep(i, 1, m) printf("%d ", a[i]); puts("");
	if(a[m] == 1) m --; else a[m] --;
	printf("%d\n", m); a[1] ++;
	rep(i, 1, m) printf("%d ", a[i]); 
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<limits.h>
int main() {
	int n, temp, a, i;
	long sum = 0, min = LONG_MAX, max = LONG_MIN;
	scanf("%d", &n);
	for (i = 0; i<n; i++) {
		scanf("%d", &a);
		sum += a;
		if (min>a) {
			min = a;
		}
		if (max<a) {
			max = a;
		}
	}
	printf("%ld %ld %ld\n", min, max, sum);
}


Measured memory_bytes: 2140
#include <iostream>
#include <set>
#include <deque>
#include<string>
#include<algorithm>
using namespace std;

int main()
{
    int n, m, a, sum = 0;
    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        cin >> a;
        sum += a;
    }
    if (n >= sum)
        cout << n - sum;
    else
        cout << -1;
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
//登録しよう！→ https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define gre greater //sortを降順にする
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
vector<string> ans;
void dfs(char c,string a,ll x){
  if(a.length() == x)ans.pb(a);
  else{
    for (char i = 'a'; i <= c; i++) {
      dfs((i == c ? (c+1):c),a+i,x);
    }
  }
}

void solve(long long N){
  dfs('a',"",N);
  sort(all(ans));
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << endl;
  }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
}


Measured memory_bytes: 7796
#include<stdio.h>
 
int main(){
	int i,j;
	int n,m;
	char id[257][11];
	char try[257][11];
	int now;// 0:Close,1:Open
	char ans[2][11]={"Opened by ","Closed by "};
	int flag;

	while(scanf("%d",&n) != EOF){
		for(i = 0;i < n;i++){
			scanf("%s",id[i]);
		}
		scanf("%d",&m);
		for(i = 0;i < m;i++){
			scanf("%s",try[i]);
		}
		now = 0;

		for(i = 0;i < m;i++){
			for(flag = 0,j = 0;j < n;j++){
				if(strcmp(id[j],try[i]) == 0){
					flag = 1;
					break;
				}
			}
			if(flag){
				printf("%s%s\n",ans[now],try[i]);
				now++;
				now %=2;
			}else{
				printf("%s%s\n","Unknown ",try[i]);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 608
import java.util.Scanner;

public class Main {
	public static void main(String[] args){

		Scanner scan01 = new Scanner(System.in);
		int dayOff = scan01.nextInt();
		int numHomework = scan01.nextInt();

		Integer dayaHomework[] = new Integer[numHomework];
		int sumDays = 0;
		for(int i=0; i<numHomework; i++){
			dayaHomework[i] = scan01.nextInt();
			sumDays = sumDays + dayaHomework[i];
		}

		if(dayOff<sumDays){
			System.out.println("-1");
		}else if(dayOff>=sumDays){
			System.out.println(dayOff-sumDays);
		}
		scan01.close();
	}
}


Measured memory_bytes: 38136
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define eps 1e-10
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

int n,m;
vector <int> ans;
char s[maxn];

int main()
{
	n=read(); m=read(); scanf("%s",s);
	int nw=n;
	while(nw!=0)
	{
		int f=0;
		for(int i=max(0,nw-m);i<nw;i++)
		{
			if(s[i]=='0')
			{
				ans.push_back(nw-i);
				nw=i,f=1;  break;
			}
		}
		if(f==0) {puts("-1"); return 0;}
	}
	for(int i=ans.size()-1;i>=0;i--) printf("%d ",ans[i]);
	return 0;
}

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

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

    int n;
    cin >> n;
    string res = "No";
    Rep (i, 1, 10) {
        Rep (j, 1, 10) {
            if (i * j == n) res = "Yes";
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 3576
#include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;

int dp[101][10001];
int N,W;
int n[101],w[10001];

int main(){
    cin >> N >> W;
    for(int i=0;i<N;i++){
        cin >> n[i] >> w[i];
    }

    for(int i=0;i<N;i++){
        for(int j=0;j<W;j++){
            dp[i][j] = 0;
        }
    }

    for(int i=N-1;i>=0;i--){
        for(int j=1;j<=W;j++){
            if(w[i] <= j){
                dp[i][j] = max(dp[i+1][j],dp[i+1][j-w[i]] + n[i]);
            }
            else{
                dp[i][j] = dp[i+1][j];
            }
        }
    }
    cout << dp[0][W] << endl;
}


Measured memory_bytes: 7012
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }

int main() {
	int h, w;
	cin >> h >> w;
	vector<vector<string>> s(h, vector<string>(w));
	REP(i, h) {
		REP(j, w) {
			cin >> s[i][j];
		}
	}
	int resh=0, resw=0;
	REP(i, h) {
		REP(j, w) {
			if (s[i][j] == "snuke") {
				resh = i;
				resw = j;
				break;
			}
		}
	}
	cout << (char)(resw + 'A' )<< resh + 1;
	return 0;
}

Measured memory_bytes: 256
program main
implicit none
integer :: n

  read(*,*) n
  call wolv_or_sheep(n)

contains

  subroutine wolv_or_sheep(n)
  integer,intent(in) :: n
  character(n)       :: s
  logical            :: t(n),sw(n)
  integer            :: i

    read(*,'(A)') s
    t(:) = [(s(i:i)=='o',i=1,n)]

    call test_seq( n, t, .TRUE.,  .TRUE.)
    call test_seq( n, t, .TRUE.,  .FALSE.)
    call test_seq( n, t, .FALSE., .TRUE.)
    call test_seq( n, t, .FALSE., .FALSE.)

    print'(I0)',-1

  end subroutine wolv_or_sheep

  subroutine test_seq(n,t,a1,a2)
  integer,intent(in) :: n
  logical,intent(in) :: t(n),a1,a2
  logical            :: res(n),accept
  integer            :: i

    res(1) = a1
    res(2) = a2

    do i=2,n-1
      res(i+1) = xor(res(i-1),t(i).neqv.res(i))
    enddo

    accept = xor( (res(n-1).eqv.res(1)).eqv.t(n), .not.res(n) )&
   &    .and.xor( (res(n)  .eqv.res(2)).eqv.t(1), .not.res(1) )

    if(accept)then
      do i=1,n
        if(res(i))then
          write(*,'(A)',advance='NO') 'S'
        else
          write(*,'(A)',advance='NO') 'W'
        endif
      enddo
      write(*,'(A)') ''
      STOP
    endif
!
  end subroutine test_seq
!
end program main


Measured memory_bytes: 1280
#include <iostream>
using namespace std;
typedef long long ll;
int main() {
  int n;ll sum=0;cin>>n;
  ll a[n+1],b;
  for(int i=0;i<n+1;i++){
    cin>> a[i];
    sum+=a[i];
  }
  for(int i=0;i<n;i++){
    cin>> b;
    if(b<=a[i]){
      a[i]-=b;
    }else{
      b-=a[i];
      a[i]=0;
      if(b<=a[i+1]){
        a[i+1]-=b;
      }else{
        a[i+1]=0;
      }
    }
    sum-=a[i];
  }
  sum-=a[n];
  
  cout <<sum<< endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <string.h>
#include <math.h>
#include <string>
using namespace std;
 
int main() {
	cin.tie(0);
  ios::sync_with_stdio(false);
 
	string s;
  cin>>s;
  for(int i=0; i<s.length(); i++){
    s[i] = 'x';
  }
  for(int i=0; i<s.length(); i++){
    cout<<s[i];
  }
 
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int
is_prime(int n)
{
    int i;

    if(n < 2) return 0;
    if(n == 2) return 1;
    if(n % 2 == 0) return 0;
    for(i = 3; i <= sqrt(n); i += 2) {
        if(n % i == 0) return 0;
    }
    return 1;
}

int
main(void)
{
    int i, n, tmp, result = 0;

    scanf("%d", &n);

    for(i = 0; i < n; ++i) {
        scanf("%d", &tmp);
        if(is_prime(tmp) == 1) result++;
    }
    printf("%d\n", result);
}



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

const int N=1e6+100;
const int mod=1e9+7;
typedef long long ll;


int prime[N];
bool vis[N];
int cnt;

int tong[N];
int su[N], x[N];;
void work()
{
    for(int i=2;i<=N;i++){
        if(!vis[i])  prime[++cnt]=i;
        for(int j=1;i*prime[j]<=N ;j++ ){
            vis[i*prime[j]]=1;
            if(i%prime[j]==0) break;
        }
    }
}

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

    work();
    /*for(int i=1;i<=100;i++){
        cout<<prime[i]<<" ";
    }*/
   // cout<<cnt<<endl;

   int n;cin>>n;

   for(int i=1;i<=n;i++){
      cin>>x[i];
      tong[x[i]]++;
   }
   if(tong[1]==n) {
    cout<<"pairwise coprime"<<endl;
    return 0;
   }
   for(int i=1;i<=cnt;i++){
     for(int j=prime[i];j<=N-100;j+=prime[i]){
        if(tong[j]){
            su[prime[i]]+=tong[j];
        }
     }
   }
   int ma=0;
   for(int i=1;i<=N-100;i++){
     ma=max(ma,su[i]);
   }
   int kk=x[1];
   if(ma==1)  cout<<"pairwise coprime"<<endl;
   else{
      for(int i=2;i<=N-100;i++){
         kk=__gcd(kk,x[i]);
         if(kk==1) break;
      }
      if(kk==1){
        cout<<"setwise coprime"<<endl;
      }
      else{
        cout<<"not coprime"<<endl;
      }
   }
    return 0;
}


Measured memory_bytes: 16592
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for( int i = 0 ; i < n ; i++ )
typedef long long ll ;
int main() {
  ll H  ;
  cin >> H ;
  ll ans = 0 ; 
  for(ll i = 0 ; i < H ; i ++ ){
      if( H >= pow(2,i) && H < pow(2,i+1) ){
          cout << (ll) pow(2,i+1) - 1 << endl;
          return 0 ; 
      } 
  }
}

Measured memory_bytes: 256
///supercalifragilisticexpialidocious.
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <cstdlib>
#include <cctype>
#include <ctime>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <utility>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <list>
#include <bitset>
#include <complex>
using namespace std;
#define f first
#define s second
#define PB pop_back
#define pb push_back
#define mp make_pair
#define int long long
#define sz(s) (int)s.size()
#define seper(n) setprecision(n)
#define all(v) v.begin(),v.end()
#define mem(a,b) memset(a,b,sizeof a)
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
typedef long long ll;
typedef map<int , int> mii;
typedef pair<int , int> pii;
typedef map<string , int> msi;
typedef pair<int , string> pis;
typedef pair<int , pair<int , int> > piii;
const int MAXN = 1e5 + 10;
int n , m , a , b , cnt[MAXN];
int32_t main()
{
	cin >> n >> m;
	for(int i = 0 ; i < m ; i ++)
		cin >> a >> b , a -- , b -- , cnt[a] ++ , cnt[b] ++;
	for(int i = 0 ; i < n ; i ++)
		if(cnt[i] & 1)
			return cout << "NO" << endl , 0;
	return cout << "YES" << endl , 0;
}



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

main(){
	int x,y,k;
	
	while(1){
		cin>>x>>y;
		if(x==0 && y==0) break;
		if(x>y){
			k=x;
			x=y;
			y=k;
		}
		cout<<""<<x<<" "<<y<<endl;
	}
}

Measured memory_bytes: 1160
from collections import deque

d = deque()
n,m = map(int,input().split())

w = [[] for i in range(n)]
c = [0 for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    w[a-1].append(b-1)
    w[b-1].append(a-1)
ans =-1
for i in range(n):
    if c[i] == 0:
        c[i] = 1
        ans += 1
        d.append(i)
        while d:
            x = d.pop()
            for i in w[x]:
                if c[i] == 0:
                    c[i] = 1
                    d.append(i)

print(ans)

Measured memory_bytes: 83840
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

pub fn bsearch<F>(ok: i64, ng: i64, pred: F) -> Option<i64>
where
    F: Fn(i64) -> bool,
{
    let orig_ok = ok;
    let mut ok = ok;
    let mut ng = ng;
    while (ok - ng).abs() > 1 {
        let mid = (ok + ng) / 2;
        if pred(mid) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    if ok == orig_ok {
        None
    } else {
        Some(ok)
    }
}

fn solve() {
    input! {
        n: usize, d: u64, a: u64,
        mut xhv: [(u64, u64); n]
    };

    xhv.sort();
    let res = bsearch(10.pow(16), 0, |x| {
        let x = x as u64;
        let mut all_count = 0_u64;
        let mut bomb_area: VecDeque<(u64, u64)> = VecDeque::new();
        let mut cur_count = 0_u64;
        for &(x, h) in &xhv {
            while let Some((bx, c)) = bomb_area.pop_front() {
                if x > bx {
                    cur_count -= c;
                } else {
                    bomb_area.push_front((bx, c));
                    break;
                }
            }
            if cur_count * a >= h {
                continue;
            }
            let rest = h - cur_count * a;
            let c = (rest + a - 1) / a;
            all_count += c;
            cur_count += c;
            bomb_area.push_back((x + d * 2, c));
        }
        all_count <= x
    })
    .unwrap();
    println!("{}", res);
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 10572
//#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <utility>
using namespace std;

char in[1<<21];
char const*o;

void init_in() { 
  o = in; 
  in[fread(in, 1 ,sizeof(in) - 4, stdin)] = 0;
}

int readInt(){ 
  unsigned u = 0, s = 0;
  while(*o && *o <= 32){
    ++o; 
  }
  if (*o == '-'){
    s = ~s, ++o;
  } else if (*o == '+'){
    ++o;
  }
   
   while(*o>='0' && *o<='9'){
    u = (u<<3) + (u << 1) + (*o++ - '0');
  }

  return static_cast<int>((u^s) + !!s) ;
}

struct task{
  int year, id;
};

int main(){
  init_in();
  int n = readInt(); int m = readInt();
  vector<vector<task>> v(101010);
  for (int i = 0; i < m; ++i) {
    int p = readInt(); int y = readInt();
    v[p].push_back({y, i + 1});
  }

  vector<int> ans1(101010), ans2(101010);

  for (int i = 1; i <= n; ++i) {
    if (v[i].empty()) continue;
    sort(v[i].begin(), v[i].end(), [](const task &x, const task &y){
      return x.year < y.year;
    });
  }

  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < (int) v[i].size(); ++j) {
      ans1[v[i][j].id] = i;
      ans2[v[i][j].id] = j + 1;
    }
  }

  for (int i = 1; i <= m; ++i) {
    cout << setfill('0') << right << setw(6) << ans1[i] << setfill('0') << right << setw(6) << ans2[i] << '\n';
  }

  return 0;
}


Measured memory_bytes: 9344
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define bitrep(X,N) for(ll X = 0; X < (1 << (N)); X++)
#define PI (acos(-1.0))
#define sorta(V) sort(V.begin(), V.end())
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end() 


using namespace std;

int main(){

    ll n;
    cin >> n;

    if(n % 2 == 0){
        cout << n << endl;
    }else{
        cout << n + n << endl;
    }


    return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE OverloadedStrings #-}
import qualified Data.ByteString.Char8 as B
import Data.Maybe

main = B.interact $ solve . readInts

readInts = map (fst . fromJust . B.readInt) . B.words

solve xs
  | odd (product xs) = "Odd"
  | otherwise = "Even"


Measured memory_bytes: 380
n,k = map(int,input().split())

mod = 10**9+7

m = 10**5 * 4 +10 
fac = [1]*m
ninv = [1]*m
finv = [1]*m
for i in range(2,m):
    fac[i] = fac[i-1]*i%mod
    ninv[i] = (-(mod//i)*ninv[mod%i])%mod
    finv[i] = finv[i-1]*ninv[i]%mod

def comb(n,k):
    return (fac[n]*finv[k]%mod)*finv[n-k]%mod
if k >= n:
    print(comb(2*n-1,n))
else:
    ans = 0
    for i in range(min(n,k+1)):
        ans += comb(n,i)*comb(n-1,i)
        ans %= mod
    print(ans)

Measured memory_bytes: 50476
class SegmentTree:
    def __init__(self,orig,func,unit):
        _len= len(orig)
        self.func = func
        self.size = 1 << (_len-1).bit_length()
        self.tree = [unit] * self.size + orig + [unit] *(self.size-_len)
        self.unit = unit
        
        for i in range(self.size -1,0,-1):
            self.tree[i] = func(self.tree[i*2], self.tree[i*2+1])
            
    def update(self, i, v):
        i+=self.size
        self.tree[i] = v
        while i:
            i//=2
            self.tree[i]=self.func(self.tree[i*2],self.tree[i*2+1])
    
    def find(self,l,r):
        l+=self.size
        r+=self.size
        ret=self.unit
        while l<r:
            if l&1:
                ret = self.func(ret,self.tree[l])
                l+=1
            if r&1:
                r-=1
                ret=self.func(ret,self.tree[r])
            l//=2
            r//=2
        return ret
      
import sys
input = sys.stdin.readline
from operator import or_

input()
seg = SegmentTree([1 << ord(x) - 97 for x in input()[:-1]], or_, 0)
ans = []
for _ in range(int(input())):
  f, x, y = input().split()
  if f == "1":
    seg.update(int(x) - 1, 1 << ord(y) - 97)
  else:
    ans.append(bin(seg.find(int(x) - 1, int(y))).count("1"))
print(*ans)

Measured memory_bytes: 48072
n,y = gets.split(" ").map(&:to_i)
ans = "-1 -1 -1" 

for c in 0..2000 do
b = (10000*n-9000*c- y)/5000
if y == 10000*(n-b-c) + 5000*b + 1000*c  && n-b-c >= 0 && b >= 0
    ans = (n-b-c).to_s + " " + b.to_s + " " + c.to_s
    break
end
end
puts ans

Measured memory_bytes: 1788
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


string a, b, c;
int main() {
  cin >> a >> b >> c;
  cout << a[0] << b[0] << c[0] << endl;
}




Measured memory_bytes: 256
#include <iostream>

using namespace std;

int a[3];

int main()
{
    string S;

    cin >> S;

    a[0] = (S[0] == 'R' ? 1 : 0);

    if(S[1] == 'R')
        a[1] = a[0] + 1;
    if(S[2] == 'R')
        a[2] = a[1] + 1;

    cout << max(a[0],max(a[1],a[2]));
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i, j, k) for(int i = j; i <= k; ++i)
#define dep(i, j, k) for(int i = j; i >= k; --i)
#define enter putchar('\n')
#define fi first
#define se second
#define mp(x, y) make_pair(x, y)

typedef long long ll;

using namespace std;

const int maxn = 3e5 + 5;
const int LOG = 35;
const int inf = 0x3f3f3f3f;

int n, m, a[maxn];

inline int read() {
	char ch = getchar(); int u = 0, f = 1;
	while(!isdigit(ch)) { if(ch == '-') f = -1; ch = getchar(); }
	while(isdigit(ch))  { u = u * 10 + ch - 48; ch = getchar(); } return u * f;
}

struct SEG {
	#define ls p << 1
	#define rs p << 1 | 1
	#define mid (l + r >> 1)
	struct Node {
		ll mn, tag;
		Node() { tag = 0; mn = (1ll << 60); }
	} t[maxn << 2];

	inline void pushtag(int p, ll x) {
		t[p].tag += x; t[p].mn += x;
	}

	inline void pushdown(int p) {
		if(t[p].tag) {
			pushtag(ls, t[p].tag);
			pushtag(rs, t[p].tag);
			t[p].tag = 0;
		}
	}

	inline void modify(int l, int r, int pos, int p, ll x) {
		if(l == r) { t[p].mn = min(t[p].mn, x); return; }
		pushdown(p);
		if(pos <= mid) modify(l, mid, pos, ls, x);
		else modify(mid + 1, r, pos, rs, x);
		t[p].mn = min(t[ls].mn, t[rs].mn);
	}

	inline void add(int l, int r, int ql, int qr, int p, ll x) {
		if(l == ql && r == qr) return pushtag(p, x);
		pushdown(p);
		if(qr <= mid) add(l, mid, ql, qr, ls, x);
		else if(ql > mid) add(mid + 1, r, ql, qr, rs, x);
		else add(l, mid, ql, mid, ls, x), add(mid + 1, r, mid + 1, qr, rs, x);
		t[p].mn = min(t[ls].mn, t[rs].mn);
	}
	
	inline ll query(int l, int r, int ql, int qr, int p) {
//		cerr << l << " " << r << " " << ql << " " << qr << endl;
		if(l == ql && r == qr) return t[p].mn;
		pushdown(p);
		if(qr <= mid) return query(l, mid, ql, qr, ls);
		else if(ql > mid) return query(mid + 1, r, ql, qr, rs);
		else return min(query(l, mid, ql, mid, ls), query(mid + 1, r, mid + 1, qr, rs));
	}
	
	inline ll getmin(int l, int r, int p, int ty) {
		if(l == r) return t[p].mn + ty * r;
		pushdown(p);
		return min(getmin(l, mid, ls, ty), getmin(mid + 1, r, rs, ty));
	}
	#undef ls
	#undef rs
	#undef mid
} T, RT;


int main() {
	n = read(); m = read(); a[1] = read(); a[2] = read(); 
	rep(i, 1, m) a[i + 2] = read();
	T.modify(1, n, a[1], 1, a[1]); RT.modify(1, n, a[1], 1, -a[1]);
	rep(i, 3, m + 2) {
		ll tmp = min(T.query(1, n, a[i], n, 1) - a[i], RT.query(1, n, 1, a[i], 1) + a[i]);
//		cerr << tmp << endl;
		T.add(1, n, 1, n, 1, abs(a[i] - a[i - 1]));
		RT.add(1, n, 1, n, 1, abs(a[i] - a[i - 1]));
		T.modify(1, n, a[i - 1], 1, tmp + a[i - 1]); RT.modify(1, n, a[i - 1], 1, tmp - a[i - 1]);
	}
	cout << T.getmin(1, n, 1, -1) << endl;
	return 0;
}
/*
f[2][1] = 0
f[3][1] = 5 -> ABB
f[3][2] = 2 -> ABA
f[4][1] = 7 -> ABBB
f[4][2] = 4 -> ABAA
f[4][3] = 5 -> ABAB
*/

Measured memory_bytes: 38528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int main(int argc, char const *argv[])
{
	int n, m, c; cin >> n >> m >> c;
	vector<int> b(m); rep(i, m) cin >> b[i];
	vector<vector<int>> a(n, vector<int>(m));
	rep(i, n)rep(j, m) cin >> a[i][j];

	int ans = 0;
	rep(i, n) {
		int sum = c;
		rep(j, m) sum += a[i][j] * b[j];
		if (sum > 0) ans++;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s; cin >> s;
	int x = count(s.begin(), s.end(), 'o') + 15 - s.size();
	if(x >= 8) cout << "YES" << endl;
	else cout << "NO" << endl;	
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        string S;
        cin >> S;
        int ans = 0;
        for (auto e : S)
            ans += (-1 + 2 * (e == '+'));
        cout << ans << endl;
    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 256