akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <iostream>
#include <queue>
#include <cstdio>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string.h>
#include <limits.h>
#include <map>
#include <string>
#include <bitset>
#include <vector>
using namespace std;
queue <long long >q;
int main() {
    int k;
    cin>>k;
    if(k<=9)
    {
        cout<<k<<endl;
        return 0;
    }
    k-=9;
    for(int i=1;i<=9;i++) q.push(i);
    while(k)
    {
        long long t=q.front();
        if(t%10)
        {
            k--;
            if(k==0)
            {
                printf("%lld\n",t*10+(t%10)-1);
                break;
            }
            q.push(t*10+(t%10)-1);
        }
        k--;
        if(k==0)
        {
            printf("%lld\n",t*10+(t%10));
            break;
        }
        q.push(t*10+(t%10));
        if(t%10<9) {
            k--;
            if (k == 0) {
                printf("%lld\n", t * 10 + (t % 10)+1);
                break;
            }
            q.push(t * 10 + (t % 10)+1);
        }
        q.pop();
    }
    return 0;
}


Measured memory_bytes: 4212
import java.io.IOException;
import java.util.Scanner;

class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		int d = sc.nextInt();
		int sum=0;
		for(int i=L;i<=R;i++) {
			if(i%d==0) {
				sum++;
			}
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 35676
#include<bits/stdc++.h>
using namespace std;
#define light ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define pb push_back
#define cases() ll t;cin>>t;while(t--)
#define all(c) c.begin(),c.end()
#define PI 3.14159265358979323846
const ll MAX = 1e5+5;
const ll INF = 1e18;
const ll MOD = 1e9+7;

int main()
{
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << max({a*d,a*c,b*c,b*d});
}

Measured memory_bytes: 3628
void main()
{
    long n = readln.chomp.to!long;
    long[] d = readln.split.to!(long[]);
    long m = readln.chomp.to!long;
    long[] t = readln.split.to!(long[]);

    d.sort!"a < b";
    t.sort!"a < b";
    long cnt;
    foreach (x; d)
    {
        if (cnt == m) break;

        if (x == t[cnt]) ++cnt;
    }

    writeln(cnt == m ? "YES" : "NO");
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 19488
#include <iostream>
#include <string>
#include <unordered_map>
#include <bits/stdc++.h>

#define MOD 1e+9;

using namespace std;

auto f=[](){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
};

int main()
{
	f();
	int n;
	cin>>n;
	int i=0;
	int mf=0;
	unordered_map<string, int> mp;
	while(i<n)
	{
		string s;
		cin>>s;
		mp[s]++;
		mf=max(mp[s],mf);
		++i;
	}
	
	vector<string> order;
	for(auto it=mp.begin();it!=mp.end();++it)
	{
		if(it->second==mf)
		{	
			order.push_back(it->first);
			//cout<<it->first<<"\n";
		}
	}
	
	sort(order.begin(),order.end());
	for(auto& it:order)
	{
		cout<<it<<"\n";
	}

	return 0;
}


Measured memory_bytes: 25284
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define LI list<int>
#define vct vector
#define D(a) (double)(a)
#define vi vct<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vvi vct<vi>
#define vll vct<ll>
#define vvll vct<vll>
#define vpii vct<pii>
#define vpll vct<pll>
#define vb vct<bool>
#define vs vector<string>
#define all(a) a.begin(),a.end()
#define allr(a) a.rbegin(),a.rend()
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define ff first
#define ss second
#define bg begin()
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define ft cout<<"for test"<<endl;
#define read(v,a,n) for(int i=a; i<n; i++)cin>>v[i];
#define print(v) for(auto it:v)cout<<it<<' ';cout<<endl;
#define PI 2*acos(0.0)
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define t_c int test,cs=1;cin>>test;while(test--)
///................function.....................///
#define siz(s) (int)(s.size())
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define mod 1000000007
int main()
{
    FIO;
    ///freopen("in.txt","r",stdin);
    ///freopen("output.txt","w",stdout);
    vi pre(1000005);
    ll i,j;
    ll nn=1000001;
    for(i=1; i<nn; i++)
    {
        for(j=i; j*i<nn; j++)
        {
            if(i!=j)
                pre[i*j]++;
            pre[i*j]++;
        }
    }
    ll n;
    cin>>n;
    ll ans=0;
    for(i=1; i<n; i++)
    {
        ll tmp = pre[i];
ans+=tmp;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 7092
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		int num1  = scan.nextInt();
		int num2 = scan.nextInt();
		int diff = num2 - num1;
		int heightWest = ((diff -1)/2)*(2 + (diff -2));
		int snow = heightWest - num1;
		if (snow < 1) snow = 1;
		System.out.println(snow);
	}

}

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

int main() {
  char letter;
  cin >> letter;
  std::cout << static_cast<char>(letter + 1) << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include "stdio.h"
#include "math.h"

long long int min_sosuu(long long int P){
  int n=(int)sqrt(P);
  for (size_t i = 2; i <= n; i++) {
    if (P%i==0) {
      return i;
    }
  }
  return P;
}

int main(int argc, char const *argv[]) {
  long long int N,P;
  scanf("%lld%lld", &N,&P);
  long long int A[100];
  long long int B[100];
  for (size_t i = 0; i < 100; i++) {B[i]=0;}
  int k=0;
  while (P!=min_sosuu(P) && P!=0) {
    A[k]=min_sosuu(P);
    while (P%A[k]==0 && P!=0) {
      B[k]++;
      P=P/A[k];
      // printf("%lld ", P);
    }
    k++;
  }
  // printf("\n");
  if (P!=0) {
    A[k]=P;
    B[k]=1;
    k++;
  }
  // for (int i = 0; i < k; i++) {
  //   printf("%d %lld %lld\n",i,A[i],B[i]);
  // }

  long long int ans=1;
  for (size_t i = 0; i < k; i++) {
    while (B[i]>=N) {
      ans=ans*A[i];
      B[i]=B[i]-N;
    }
  }
  printf("%lld", ans);
  return 0;
}

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

namespace ARC059D {
    class Program {
        static void Main(string[] args) {
            string s = Console.ReadLine();
            int ansa = -1;
            int ansb = -1;
            for (int i = 0; i < s.Length; i++) {
                string x = s.Substring(i, 1);
                if (i < s.Length - 1) {
                    if (x == s.Substring(i + 1, 1)) {
                        ansa = i + 1;
                        ansb = i + 2;
                        break;
                    }
                }
                if (i < s.Length - 2) {
                    if (x == s.Substring(i + 2, 1)) {
                        ansa = i + 1;
                        ansb = i + 3;
                        break;
                    }
                }
            }
            Console.WriteLine(ansa.ToString() + " " + ansb.ToString());
        }
    }
}


Measured memory_bytes: 15328
#include<iostream>
#include<set>

int main(){
  int N; std::cin >> N;
  std::set<int> s {};
  for(auto i=0; i<N; ++i){
    int a; std::cin >> a;
    if(s.find(a) == s.end())
      s.insert(a);
    else
      s.erase(a);
  }
  std::cout << s.size() << '\n';
}


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

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

  int x, y, z;
  bool flag = false;

  for (int i = 0; i <= N; i++) {
    for (int j = 0; j <= N-i; j++) {
        if (1000*i+5000*j+10000*(N-i-j) == Y) {
          flag = true;
          x = i;
          y = j;
          z = N-i-j; 
          break;
      }
    }
  }
  if (flag) {
    cout << z << " " << y << " " << x;
  } else {
    cout << -1 << " " << -1 << " " << -1;
  }
}

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

#define ll long long
#define LINF LLONG_MAX

using namespace std;

int main() {
  string s;
  int K;
  cin >> s >> K;
  int size = s.size();
  for (int i = 0; i < size; i++) {
    int index = 26 - (s[i] - 'a');
    if (s[i] == 'a') {
      continue;
    }
    if (index <= K) {
      s[i] = 'a';
      K = K - index;
    }
  }
  s[size - 1] = char(s[size - 1] + (K % 26));
  cout << s << endl;
}

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

using namespace std;

int main(){
    int N;
    long long Y;
    cin >> N;
    cin >> Y;

    int a=-1,b = -1,d= -1;

    for(int i = 0;i <= N;i++)
        for(int j = 0;j <= N;j++){
            int c = N - j -i;
            int total = 10000*i+5000*j+1000*c;
            if(i + j +c == N && Y == total && c >= 0){
                a = i;
                b = j;
                d = c;
                break;
            }
        }

    cout << a << " " << b << " " << d << endl;
    
    
    


}

Measured memory_bytes: 3608
import java.util.*;
public class Main {
    
    public static void main(String[] args) throws InterruptedException{
            Scanner sc = new Scanner(System.in);
            
            int counter = 0;
            
            int n = sc.nextInt();
            int[] a = new int[n];
            for(int i = 0;i<n;i++){
                a[i] = sc.nextInt();
            }
            for(int i = 0;i<n;i++){
                if(i+1 == a[a[i]-1])
                    counter++;
            }
            System.out.println(counter/2);
    }
}

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

#define endl '\n'
#define ll long long
#define re register
#define pb(x) push_back(x)
#define ce(x) cout << x << '\n';

using db = long double;
using pll = pair < ll, ll >;

#define rep(i,x,n,inc) for(i=x ; i<n ; i+=inc)
#define repr(i,x,n,inc) for( i=x ; i>n ; i+=inc)
#define all(a)      (a).begin(),(a).end()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define hell 1000000007
const db pi = acos(-1);
const long long infl = LLONG_MAX;

#define Foxen(i,s) for (i=s.begin(); i!=s.end(); i++)
#define Fill(s,v) memset(s,v,sizeof(s))
#define cout_p(x, p) cout << fixed << setprecision((p)) << x << endl     //print with precision

#define tc(tt) \
    ll tt;    \
    cin >> tt; \
    for (ll _tt = 0; _tt < tt; _tt++) // testcase 

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

ll t,i,x,j,y,z,k,n;

cin>>n;
cout<<n*n;
}


Measured memory_bytes: 764
/*#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <array>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
*/

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())

typedef long long ll;
const ll INF = 1e15+7;
const ll mod = 1e9 + 7;
const int MAX_N = 1e5 + 5;
int dx[] = { -1LL,0,1LL,0 }, dy[] = { 0,1LL,0,-1LL };
vector<ll> prime;

ll inv[MAX_N], fac[MAX_N];

template <class T = ll> T in() { T x; cin >> x; return (x); }
inline ll GCD(ll a, ll b) { ll c; while (b != 0) { c = a % b; a = b; b = c; }return a; }
inline ll LCM(ll a, ll b) { return a * b / GCD(a, b); }
inline ll POW(ll a, ll b) { ll c = 1LL; while (b > 0) { if (b & 1LL) { c = a * c%mod; }a = a * a%mod; b >>= 1LL; }return c; }
inline void _nCr() { fac[0] = 1LL; for (int i = 1LL; i < MAX_N; i++) { fac[i] = fac[i - 1LL] * i%mod; }for (int i = 0; i < MAX_N; i++) { inv[i] = POW(fac[i], mod - 2); } }
inline ll nCr(ll n, ll r) { return (fac[n] * inv[r] % mod)*inv[n - r] % mod; }
inline void PRI(ll n) { bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) { a[i] = 1LL; }for (int i = 2; i < n + 1LL; i++) { if (a[i]) { prime.pb(i); ll b = i; while (b <= n) { a[b] = 0; b += i; } } } }

vector<vector<int>> kake(vector<vector<int>> &tim1,vector<vector<int>> &tim2) {
	vector<vector<int>> res = vector<vector<int>>(tim1.size(),vector<int>(tim1[0].size(),0));
	REP (i,tim1.size()) {
		REP (j,tim1[0].size()) {
			REP (k,tim2[0].size()) {
				res[i][k] += tim1[i][j] * tim2[j][k];
				res[i][k] %= mod;
			}
		}
	}
	return res;
}

class UnionFind {
private:
	vector<int> par;
public:
	UnionFind(int N) { par = vector<int>(N, -1LL); }
	int find(int x);
	ll size(int x);
	void unite(int x, int y);
	bool same(int x, int y);
};



//----UnionFind-------------------------------
int UnionFind::find(int x) {
	if (par[x] < 0) return x;
	else return par[x] = find(par[x]);
}

ll UnionFind::size(int x) {
	return -par[find(x)];
}

void UnionFind::unite(int x, int y) {
	x = find(x);
	y = find(y);

	//大きい方に小さい方をくっ付ける
	if (size(x) < size(y)) swap(x, y);
	par[x] += par[y];
	par[y] = x;
}

bool UnionFind::same(int x, int y) {
	x = find(x);
	y = find(y);
	return x == y;
}

signed main() {
	int n; cin >> n;
	set<pair<int,pair<int,int>>> se;
	REP (i,n) {
		int p[3];
		REP (j,3) cin >> p[j];
		sort(p,p+3);
		se.insert({p[0],{p[1],p[2]}});
	}
	cout << n - se.size() << endl;
}



Measured memory_bytes: 3172
import sys;sys.setrecursionlimit(int(1e7))

N = int(input())
ABC = [tuple(map(int, input().split())) for i in range(N-1)]
Q, K = map(int, input().split())
XY = [tuple(map(int, input().split())) for i in range(Q)]

tree = [[] for i in range(N+1)]   
depth = [None] * (N+1)

for abc in ABC:
    tree[abc[0]].append((abc[1],abc[2]))
    tree[abc[1]].append((abc[0],abc[2]))
    
def DFS(v, p, d):
    depth[v] = d
    for e in tree[v]:
        if e[0] != p:
            DFS(e[0], v, d + e[1])
            
DFS(K, 0, 0)

for x,y in XY:
    print(depth[x] + depth[y])

Measured memory_bytes: 153016
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> v(n);
    for (int i=0; i < n; i++) cin >> v[i];
    vector<pair<int, int> > srt;
    for (int i=0; i < n; i++) srt.push_back(make_pair(v[i], i));
    sort(srt.begin(), srt.end());
    int ans = 1e18;
    for (int i=0; i < n; i++){
        if (i!=0){
            if (srt[i-1].first == srt[i].first) continue;
        }
        vector<int> block;
        for (int j=0; j < i; j++) block.push_back(srt[j].second);
        block.push_back(-1);
        block.push_back(n);
        sort(block.begin(), block.end());
        vector<int> abl;
        for (int j=0; j < block.size() - 1; j++){
            vector<int> best;
            for (int p=block[j]+1; p <= block[j+1]-1; p++) best.push_back(v[p]);
            sort(best.begin(), best.end(), greater<int>());
            while (best.size() >= k){
                abl.push_back(best.back());
                best.pop_back();
            }
        }
        sort(abl.begin(), abl.end());
        if (abl.size() < q) continue;
        ans = min(ans, abl[q-1] - abl[0]);
    }
    cout << ans;
}


Measured memory_bytes: 384
N=int(input())
S=input()
R=S.count("R")
G=S.count("G")
B=S.count("B")
ans=R*G*B
for i in range(N):
    for j in range(i,N):
        k=j+j-i
        if k>=N:
            continue
        if S[i]!=S[j] and S[i]!=S[k] and S[j]!=S[k]:
            ans-=1
print(ans)


Measured memory_bytes: 73548
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define LL long long

using namespace std;

const int N = 5010;
const LL inf = 0x3f3f3f3f3f3f3f3f;
struct node{
	LL s, w;
}f[N];
LL dp[N];

int cmp(const node&a, const node&b) {
	return a.s+a.w < b.s+b.w;
}

int main() {
	int n;
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) scanf("%lld%lld", &f[i].s, &f[i].w);
	sort(f+1, f+n+1, cmp);
	memset(dp, 0x3f, sizeof(dp));
	dp[0] = 0;
	for(int i = 1; i <= n; i++)
		for(int j = n; j; j--) {
			if(f[i].s >= dp[j-1]) dp[j] = min(dp[j], dp[j-1]+f[i].w);
		}
	int ans = 0;
	for(int i = 1; i <= n; i++) if(dp[i] < inf) ans = i;
	printf("%d\n", ans);
}

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

#define pb 		push_back
#define mp 		make_pair
#define prior   priority_queue
#define MOD 	1000000007
#define INF64 	(long long)1e18
#define INF 	(int)1e9
#define PI 		3.1415926535897932384626433832795 
#define ll      long long
#define ld		long double
#define ret     return
#define NUM 	1000001
const int SIZE = 2e5+4;
void fastio(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

void input(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
}

void solveTest(){
	
}

int main(){
	fastio();
	//input();

	/*int t;
	cin>>t;
	while(t--){
		solveTest();
	}*/

	int k,n;
	cin>>k>>n;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	int mx = -1;
	for(int i=1;i<n;i++){
		mx = max(mx,a[i]-a[i-1]);
	}
	mx = max(mx,a[0]+k-a[n-1]);
	cout<<k-mx<<endl;

	return 0;
}


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

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30

using namespace std;

int main()
{
	int n;
	while(cin >> n && n)
	{
		map<int,int> m;
		rep(i,n)
		{
			int temp;
			cin >> temp;

			m[temp]++;
		}
		
		rep(i,10)
		{
			if(m[i] == 0) cout << "-" << endl;
			else
			{
				rep(j,m[i]) cout << "*";
				cout << endl;
			}
		}
	}
}

Measured memory_bytes: 1188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,j,n) for(ll i=j;i<n;i++ )
typedef pair<ll,ll> P;
const ll mod = 1000000007;
const ll INF = 1000000009;
ll i;

int main(){
    string s;
    cin>>s;
    ll n=s.length();
    vector<ll> people(n,0);
    ll r=1,l=0;
    ll lsr=0,lsl=n;
    rep(i,1,n){
        if(s.at(i)=='R'){
            r++;
            
            if(s.at(i-1)=='L'){
                people.at(lsr)+=l/2;
                people.at(lsr+1)+=(l+1)/2;
                l=0;
            }
            lsr=i;
        }
        else if(s.at(i)=='L'){
            l++;
            lsl=i;
            if(s.at(i-1)=='R'){
                people.at(lsl)+=r/2;
                people.at(lsl-1)+=(r+1)/2;
                r=0;
            }
        }
        if(i==n-1){
            people.at(lsr)+=l/2;
            people.at(lsr+1)+=(l+1)/2;
        }
    }
    rep(i,0,n)cout<<people.at(i)<<" ";
    cout<<endl;
}

Measured memory_bytes: 1408
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#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>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;

// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
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};

const int MOD = 1e9 + 7;
const int INF = INT_MAX;

signed main() {
    Fast();

    string s;
    cin >> s;

    int ans;
    for(int i=0; i<s.length(); i++){
        if(s[i] == '-') ans--;
        else ans++;
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vd(T) vector<vector<T>>
#define v(T) vector<T>
#define mod (ll)(1e9+7)
#define pp(T) pair<T,T>
#define pb push_back
#define mp make_pair
#define NN 100005
#define IO ios_base::sync_with_stdio(NULL),cin.tie(0),cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define DEBUG cout<<"***********DEBUGGING***********"<<endl
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; 
ll power(ll a,ll b){ if(b==0) return 1; ll s=power(a,b/2); s*=s;if(b&1) return s*a; return s;}
ll powermod(ll a,ll b,ll m){ if(b==0) return 1; ll s=power(a,b/2);s*=s; s%=m; if(b&1) return (s*a)%m; return s;}
inline int add(ll a,ll b,ll m=0){
    if(m==0) return a+b;
    return (a%m+b%m)%m;
}

inline int sub(ll a,ll b ,ll m=0){
    if(m==0) return a-b;
    return ((a%m-b%m)%m+m)%m;
}

inline int mul(ll a,ll b,ll m=0){
    if(m==0)return (a*b);
    return ((a%m)*(b%m))%m;
}

inline int div(ll a,ll b,ll m=0){
    if(m==0) return a/b;
    return ((a%m)*(powermod(a,b,m-2)%m))%m;
}

bool isopen(char c){
    return ((c=='(')||(c=='{')||(c=='['));
}

ll longest_balanced_parenthesis(string a,ll n){
    stack<char> s;
    ll start=0;
    ll ans=0,m=0;
    for(ll i=0;i<n;i++){
        if(isopen(a[i])){
            s.push(a[i]);
        }
        else{
            if(isopen(a[i])|| s.empty()){
                m=max(m,ans);
                continue;
            }
            else{
                s.pop();
                ans+=2;
                m=max(ans,m);
            }
        }
    }

    return m;

}

ll setup_k(ll *a,ll k){
  ordered_set x;
  // Now , insert and then check number of integers less than k by just using x.order_of_key(k+1)
}

int main() {

    IO; 

    string s;
    cin>>s;
    ll l=s.length();
    if((l%2 && s[0]==s[l-1]) || (s[0]!=s[l-1] && l%2==0)){
        cout<<"Second"<<endl;
    }
    else{
        cout<<"First"<<endl;
    }
    

}

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

/* #pragma */
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>constexpr bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>constexpr bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
constexpr int32_t GCD(int32_t a, int32_t b){return b ? GCD(b, a%b) : a;}
constexpr int64_t GCD(int64_t a, int64_t b){return b ? GCD(b, a%b) : a;}
constexpr int32_t LCM(int32_t a, int32_t b){return a / GCD(a, b) * b;}
constexpr int64_t LCM(int64_t a, int64_t b){return a / GCD(a, b) * b;}

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
constexpr int32_t INF = 1001001001;
constexpr int64_t LINF = 1001001001001001001ll;
constexpr int32_t MOD = 1e9 + 7;
constexpr int32_t EPS = 1e-9;
constexpr int32_t dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//constexpr int32_t dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};


//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//g++ -std=c++14 -Wall --pedantic-errors template.cpp
//chcp 65001

#define int int64_t

/*global*/



signed main()
{
	int a,b,c,d; cin >> a >> b >> c >> d;--a;
	auto f = [&](int x){
		return b/x-a/x;
	};
	cout << b-a-(f(c)+f(d)-f(LCM(c,d))) << '\n';
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;
int main()
{

long int a,b,i,c=0,ans;
cin>>a>>b;
if(a<b)
{
for(i=a;i<=b;i++)
{
  if(abs(a-i)==abs(b-i))  
        {
        c++;
ans=i;
           break; 
        
    }
    

}
if(c==0)
cout<<"IMPOSSIBLE"<<endl;
else

cout<<i<<endl;
}

else 
{

for(i=b;i<=a;i++)
{
  if(abs(a-i)==abs(b-i))  
        {
        c++;
ans=i;
           break; 
        
    }
    

}
if(c==0)
cout<<"IMPOSSIBLE"<<endl;
else

cout<<i<<endl;

}






return 0;
}

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

int main(void){
  int n;
  cin >> n;
  for (int x = 0; x <= n; x += 4) {
    if ((n - x) % 7 == 0){
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()
template<class T>
using reverse_priority_queue = priority_queue<T, vector<T>, greater<T>>;

struct mint{
    static const long long MOD = 1000000007;

    long long v;

    mint() : v(0) {}
    mint(long long x){
        x = x % MOD;
        if(x < 0){ x += MOD; }
        v = x;
    }
    mint& operator+=(mint a){
        v += a.v;
        if(v >= MOD){ v -= MOD; }
        return *this;
    }
    mint& operator*=(mint a){
        v *= a.v;
        v %= MOD;
        return *this;
    }
    mint& operator-=(mint a){
        v -= a.v;
        if(v < 0){ v += MOD; }
        return *this;
    }
    mint& operator/=(mint a){
        return (*this) *= a.inv();
    }

    mint operator*(mint a) const{
        return mint(v) *= a;
    }

    mint operator+(mint a) const {
        return mint(v) += a;
    }

    mint operator-(mint a) const {
        return mint(v) -= a;
    }

    mint operator/(mint a) const {
        return mint(v) /= a;
    }

    mint pow(long long k) const {
        mint res(1),tmp(v);
        while(k){
            if(k&1) res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    mint inv(){return pow(MOD - 2); }

    static mint comb(long long n, int k){
        mint res(1);
        for(int i = 0; i < k; ++i){
            res *= mint(n - i);
            res /= mint(i + 1);
        }
        return res;
    }

    static mint factorial(long long n){
        mint res(1);
        for(int i = n; i > 1; --i){
            res *= mint(i);
        }
        return res;
    }

    bool operator<(const mint &a) const {
        return v < a.v;
    };
};

mint operator*(long long l, mint r){ return r * l; }

std::ostream& operator<<(std::ostream& stream, const mint& m){
    stream << m.v;
    return stream;
}

int main(){
    ll s;
    cin >> s;
    vector<mint> ans(max(6LL, s + 1), 0);
    ans.at(3) = 1;
    ans.at(4) = 1;
    ans.at(5) = 1;
    for(ll t = 6; t <= s; ++t){
        ans.at(t) = 1;
        for(ll r = 3; r <= t - 3; ++r){
            ans.at(t) += ans.at(r);
        }
    }
    cout << ans.at(s) << endl;
    return 0;
}


Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int c = sc.nextInt();
		
		long[][] col = new long[3][c];
		long[][] price = new long[c][c];
		
		//read price table
		for(int i = 0; i < c; i++)
			for(int j = 0; j < c; j++)
			{
//				int pr = sc.nextInt();
				price[i][j] = sc.nextInt();
			}
		
		long[][] groupprice = new long[3][c]; //price if group x goes to color y
		
		//read grid
		for(int y = 1; y <= n; y++)
			for(int x = 1; x <= n; x++)
			{
				int cur = sc.nextInt()-1;
				int group = (x+y)%3;
				while(group<0)group+=3;
				
				col[group][cur]++;
//				System.out.println(x + " " + y +": group " + group);
			}
		
		//reread price table
		for(int i = 0; i < c; i++)
			for(int j = 0; j < c; j++)
			{
				//i to j
				for(int g = 0; g < 3; g++)
				{
					groupprice[g][j] += price[i][j]*col[g][i];
//					System.out.println(i + " " + j + ": group " + g + " into color " + j +": pay " + price[i][j] + " times " + col[g][i]);
				}
			}

		long min = 999999999999l;
		for(int col1 = 0; col1 < c; col1++)
			for(int col2 = 0; col2 < c; col2++)
				for(int col3 = 0; col3 < c; col3++)
				{
					if(col1 == col2 || col2 == col3 || col1 == col3)continue;
					
					long wro = groupprice[0][col1] + groupprice[1][col2] + groupprice[2][col3];
					
					if(wro < min)
					{
//						System.out.println(col1 + " " + col2 + " " + col3 + ": " + wro);
//						System.out.println(groupprice[0][col1] + " " + groupprice[1][col2] + " " + groupprice[2][col3]);
					}
					min = Math.min(min, wro);
					
				}

		System.out.println(min);
	}

}


Measured memory_bytes: 81648
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<string>
#include<queue>
#include<tuple>
#include<utility>
#include<functional>
#include<algorithm>

#define LL long long

using namespace std;

int n,m,ans[5];
bool err=false;

int main() {
	cin>>n>>m;
	for(int i=0;i<n;i++)ans[i]=-1;
	for(int i=0;i<m;i++){
		int s,c;
		cin>>s>>c;
		if(n!=1&&s==1&&c==0)err=true;
		if(ans[s-1]!=-1&&ans[s-1]!=c)err=true;
		ans[s-1]=c;
	}
	for(int i=0;i<n;i++){
		if(n!=1&&i==0)ans[i]=max(ans[i],1);
		else ans[i]=max(ans[i],0);
	}
	if(err)cout<<-1<<endl;
	else {
		for(int i=0;i<n;i++)cout<<ans[i];
		cout<<endl;
	}
	return 0;
}



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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b;cin >> a >> b;
	string s;cin >> s;
	rep(i,a){
		if(s.at(i)>='0' && s.at(i)<='9') continue;
		else{
			cout << "No" << endl;
			return 0;
		}
	}
	if(s.at(a)!='-'){
		cout << "No" << endl;
		return 0;
	}
	for(int i=a+1;i<=a+b;++i){
		if(s.at(i)>='0' && s.at(i)<='9') continue;
		else{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        int C = Integer.parseInt(sc.next());

        System.out.println((C >= A && C <= B)? "Yes" : "No");
    }
}


Measured memory_bytes: 23764
import java.util.*;
import java.io.*;

class Main {

	void solve() {
		
		int k = inint(), x = inint();
		out.println(500*k>=x ? "Yes" : "No");
		
	}

	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}

	public int inint() {
		return in.nextInt();
	}

	public long inlong() {
		return in.nextLong();
	}

	public String instr() {
		return in.next();
	}

	public char inchar() {
		return in.next().charAt(0);
	}

	public int[] inintar(int num) {
		int[] a = new int[num];
		for (int i=0; i<num; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}

	public char[][] incharmap(int h, int w) {
		char[][] a = new char[h][w];
		for (int i=0; i<h; i++) {
			String temp = in.next();
			for (int j=0; j<w; j++) {
				a[i][j] = temp.charAt(j);
			}
		}
		return a;
	}

}

Measured memory_bytes: 21712
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,y,z,temp,temp1,temp2,temp3;
    cin>>x>>y>>z;
    temp=x;
    temp1=y;
    x=temp1;
    y=temp;
    temp2=x;
    temp3=z;
    x=temp3;
    z=temp2;
    cout<<x<<" "<<y<<" "<<z<<endl;
    return 0;
}


Measured memory_bytes: 256
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(A[k - 1])


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const int INF = 2e9;
template<class T> void print(const T& t){ cout << t << endl; }
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
    ll m1, d1, m2, d2;
    cin >> m1 >> d1 >> m2 >> d2;
    if(d2-d1==1){
        print('0');
    }
    else{
        print('1');
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
const long long INF = numeric_limits<long long>::max();
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    vector<char> S( 9 );
    for( auto && x : S) cin >> x;
    cout << S[0] << S[4] << S[8] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define SaveTime ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define mx *max_element
#define mi *min_element
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
const int N = 1e2+5;
const int INF = 1e18L;
int ncr(int n,int r){if(n<r)return 0;int p=1,k=1;if(n-r<r)r=n-r;if(r!=0){while(r){p*=n;k*=r;int g=__gcd(p, k);p/=g;k/=g;n--;r--;}}else p=1;return p;}
#define pi 2*acos(0.0)
int wt[N];
int val[N];
int dp[N][200200];
int solve(int i ,int w){
if(dp[i][w]!=-1)return dp[i][w];
if(i==0 || w ==0 )return dp[i][w]=0;
if(wt[i]>w)return solve(i-1,w);
else{
	int a = solve(i-1,w);
	int b = val[i] + solve(i-1,w-wt[i]);
	dp[i][w] = max(a,b);
	return dp[i][w];
	}
}
signed main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	SaveTime;
	int T=1;
	// cin >> T;
	while(T--){
		int n , w;
		cin >> n >> w;
		memset(dp,-1,sizeof(dp));
		for(int i =1;i<=n;i++){
			cin >> wt[i] >> val[i] ;
		}
		solve(n,w);
		cout << dp[n][w] << endl;
	}
	
	return 0;
}


Measured memory_bytes: 164480
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		int sum = 0;

		if(a <= b){
			sum += a;
			if(b <= c){
				sum += b;
			}else{
				sum += c;
			}
		}else{
			sum += b;
			if(a <= c){
				sum += a;
			}else{
				sum += c;
			}
		}

		System.out.print(sum);

	}

}


Measured memory_bytes: 21844
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

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

    static class CSnukeFestival {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];
            int[] b = new int[n];
            int[] c = new int[n];
            for (int i = 0; i < n; i++) a[i] = in.nextInt();
            for (int i = 0; i < n; i++) b[i] = in.nextInt();
            for (int i = 0; i < n; i++) c[i] = in.nextInt();
            Arrays.sort(a);
            Arrays.sort(b);
            Arrays.sort(c);
            long sum = 0;

            for (int i = 0; i < n; i++) {
                // 各b_iについてそれより小さいa_iの個数とそれより大きいc_iの個数を探す
                int ng = -1;
                int ok = a.length;
                while (Math.abs(ok - ng) > 1) {
                    int mid = (ok + ng) / 2;
                    if (a[mid] >= b[i]) {
                        ok = mid;
                    } else {
                        ng = mid;
                    }
                    // ok個
                }
                long cnta = ok;

                ng = -1;
                ok = c.length;
                while (Math.abs(ok - ng) > 1) {
                    int mid = (ok + ng) / 2;
                    if (c[mid] > b[i]) {
                        ok = mid;
                    } else {
                        ng = mid;
                    }
                }
                // c[ng]までが満たさない
                long cntc = n - 1 - ng;
                sum += cnta * cntc;
            }

            out.println(sum);

        }

    }
}



Measured memory_bytes: 94160
from collections import deque

k = int(input())
cand = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
temp = []
for i in range(k):
    t = cand.popleft()
    temp.append(t)
    if t % 10 != 0:
        cand.append(t*10+(t%10-1))
    cand.append(t*10+(t%10))
    if t % 10 != 9:
        cand.append(t*10+(t%10+1))
print(temp[k-1])

Measured memory_bytes: 16596
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner in = new Scanner(System.in);
		long a = in.nextLong();
		long b = in.nextLong();
		long c = in.nextLong();
		int ret = solv(a, b, c);
		System.out.println(ret);
	}

	private static int solv(long a, long b, long c) {
		int count = 0;
		if (a == b && b == c) return a % 2 == 0 ? -1 : 0 ;

		while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
			count++;
			long aa = a / 2;
			long bb = b / 2;
			long cc = c / 2;
			a = bb + cc;
			b = aa + cc;
			c = aa + bb;
		}
		return count;
	}
}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define rbg rbegin()
#define red rend()
#define all(x) x.bg,x.ed
#define rall(x) x.rbg,x.red
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b; return true;} return false;}
template<class t,class u> bool chmin(t&a,u b){if(a>b){a=b; return true;} return false;}
template<class t,class u> t MAX(t a,u b){if(a>=b) return a; return b;}
template<class t,class u> t MIN(t a,u b){if(a<=b) return a; return b;}
template<class t> int SIZE(t s){return (int)s.size();}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using vvi=vc<vc<int>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    int a,b,c; cin >> a >> b >> c;
    cout << max(0, c-(a-b)) << endl;
    return 0;
}


Measured memory_bytes: 256
//https://atcoder.jp/contests/dp/tasks/dp_u
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}}star;
#define DEBUG if(0)
#endif
#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}
class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};

int N;
LL a[16][16];
LL c[1<<16];
LL dp[1<<16];
int main(){
    using B=bitset<16>;
    cin>>N;
    for(int i:range(N)){
        for(int j:range(N)){
            cin>>a[i][j];
        }
    }
    for(int b:range(1<<N)){
        B bit(b);
        for(int i:range(N)){
            for(int j:range(i+1,N)){
                if(bit[i]&&bit[j]){
                    c[b]+=a[i][j];
                }
            }
        }
    }
    for(int nb:range(1<<N)){
        int b=nb;
        do{
            chmax(dp[nb],dp[b]+c[nb-b]);
            b=(b-1)&nb;
        }while(b!=nb);
    }
    cout<<dp[(1<<N)-1]<<endl;
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int64_t> L(N+1);
  L.at(0) = 2;
  L.at(1) = 1;
  for(int i=2;i<=N;i++)
    L.at(i) = L.at(i-2) + L.at(i-1);
  printf("%ld", L.at(N));
}

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


void solve(std::string S, std::string T){
    cout << T << S << endl;
}

int main(){
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    solve(S, T);
    return 0;
}


Measured memory_bytes: 3600
#include <stdlib.h>
#include <stack>
#include <string>
#include <iostream>
using namespace std;

void rpn(string next_value, stack<int> &operand);
void print_array(int *array, int size);
int main(){
	string next_value;
	stack<int> operand;

	while(cin >> next_value){
		rpn(next_value, operand);
	}

	cout << operand.top() <<endl;
	return 0;
}
void rpn(string next_value, stack<int> &operand){
	if(next_value[0] == '+'){
		int right = operand.top(); operand.pop();
		int left = operand.top(); operand.pop();
		operand.push(left+right);
	}else if(next_value[0] =='-'){
		int right = operand.top(); operand.pop();
		int left = operand.top(); operand.pop();
		operand.push(left-right);
	}else if(next_value[0] == '*'){
		int right = operand.top(); operand.pop();
		int left = operand.top(); operand.pop();
		operand.push(left*right);
	}else{
		operand.push(atoi(next_value.c_str()));
	}
}

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

int bfs(int H, int W, int sx, int sy, vector<vector<char> > maze_origin ){
    char maze[H][W];
    int d[H][W];
    typedef pair<int, int> P;
    int dx[4] = {1, 0, -1, 0};
    int dy[4] = {0, 1, 0, -1};

    queue<P> que;                
    //初期化
    for(int h = 0; h < H; h++){
        for(int w = 0; w < W; w++){
            maze[h][w] = maze_origin[h][w];
            d[h][w] = INF;
        }
    }
    que.push(P(sx,sy));
    d[sx][sy] = 0;
    while(que.size()){
        P p = que.front();
        que.pop();
        for(int i = 0; i < 4; i++){
            int nx = p.first + dx[i];
            int ny = p.second + dy[i];

            if(0<=nx && nx < H && 0<=ny && ny < W && maze[nx][ny] != '#' && d[nx][ny] == INF){
                que.push(P(nx,ny));
                d[nx][ny] = d[p.first][p.second] +1;
            }
            
        }
    }

    int maxd=0;
    for(int h = 0; h < H; h++){
        for(int w = 0; w < W; w++){
            if(d[h][w]==INF) continue;
            maxd = max(maxd, d[h][w]);
            //cout << "d(" << h << "," << w <<  ")" << d[h][w] << endl;
        }
    }
    return maxd;
}


int main(){
    ll H,W;
    cin >> H >> W;
    vector<char> maze_origin_tmp(W);
    vector<vector<char> > maze_origin;
    for(int i = 0; i < H; i++) maze_origin.push_back(maze_origin_tmp);


    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            cin >> maze_origin[i][j];
        }
    }

    //start
    int ans=0;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){

            if( maze_origin[i][j] == '#') continue;
            int ret = bfs(H,W,i,j,maze_origin);
            //cout << ret << endl;
            ans = max( ans, ret );
        }
    }

    cout << ans << endl;


}

Measured memory_bytes: 256
#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;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

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

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 T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



int n, a, v;

int main() {
    while (cin >> n) {
        int Max = -1, pMin = 1000;
        for (int i = 0; i < n; ++i) {
            cin >> a >> v;
            if (Max < v) { Max = v, pMin = a; }
            else if (Max == v) { chmin(pMin, a); }
        }
        cout << pMin << " " << Max << endl;
    }
    return 0;
}


Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int p = 0, g = 0, score = 0;
    rep(i, 0, s.size()){
        if(s[i] == 'g'){
            if(p < g){
                p++; score++;
            }else{
                g++;
            }
        }else{
            if(p < g){
                p++;
            }else{
                g++; score--;
            }
        }
    }
    cout << score << endl;
}

Measured memory_bytes: 512