akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-
"""
B - Five Dishes
https://atcoder.jp/contests/abc123/tasks/abc123_b

"""
import sys


def solve(dishes):
    dishes = sorted(dishes, key=lambda x: [10, 1, 2, 3, 4, 5, 6, 7, 8, 9][x%10])
    ans = dishes[0]
    for d in dishes[1:]:
        ans += (d+9) // 10 * 10
    return ans


def main(args):
    dishes = [int(input()) for _ in range(5)]
    ans = solve(dishes)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<cmath>
#define pb push_back
#define ld long double
#define mp make_pair
#define vl vector<ll> 
#define vd vector<double>
#define vld vector<long double>
#define ll long long int
#define pl pair<ll, ll>
#define all(a) a.begin(), a.end()
#define forr(i, n) for(ll i=0; i<n; i++) 
#define forr1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ld PI =3.1415926535897923846;
const ll MOD = 1e9+7;
void solve()
{
    ll k, a, b;
    cin>>k>>a>>b;
    for(ll i=a; i<=b; i++)
    {
        if(i%k==0)
        {
            cout<<"OK";
            return;
        }
    }
    cout<<"NG";
}
int main()
{
    ll test=1;
    //cin>>test;
    while(test--)
        solve();
}

Measured memory_bytes: 3624
/* Author rumoisen */
/* created 2018/10/14 */

#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <iostream>

using namespace std;
 
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

void no(){cout<<"No"<<endl;exit(0);}
void yes(){cout<<"Yes"<<endl;exit(0);}
void No(){cout<<"NO"<<endl;exit(0);}
void Yes(){cout<<"YES"<<endl;exit(0);}

using namespace std;

int main(void)
{
    
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll x=a*b,y=c*d;
    cout<<max(x,y)<<endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))


#define forr(i,n) for(i=0; i<n; i++)
#define whilee(i,t) while(i!=t)
//#define pb(x) push_back(x);

//sort(A.begin(),A.end());
//binary_search(A.begin(),A.end(),x);
//reverse(A.begin(), A.end());
//cout << *max_element(A.begin(), A.end());
//cout << *min_element(A.begin(), A.end());
//accumulate(A.begin(), A.end(), 0);
//next_permutation(A.begin(), A.end());
//prev_permutation(A.begin(), A.end());



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

    //vector <int> A;
    //deque <int> A;
    //queue <int> A;
    //stack <int> A;
    //set <int> A;
    //map <int,int> A;
    //pair <int,int> A ;
    //vector <pair <int,int>> A ;
    //string S, T;
    int i, j, k, a, b, c, l, m, n, p, q, r, s, t, x, y, z, cnt=0;
    cin>>n;
    forr(i,n)
    {
        if(i%2==0)
        {
            cnt++;
        }
    }
    cout<<(n-cnt)*cnt<<endl;

    return 0;
}




Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a >= 13) System.out.println(b);
        else if(a >= 6 && a <= 12) System.out.println(b/2);
        else System.out.println("0");
	}
}

Measured memory_bytes: 21844
fun main() {
    val (X, Y) = readInts()
    if (Y < 2 * X || Y % 2 != 0) println("No")
    else {
        val y = (Y - 2 * X) / 2
        val x = X - y
        println(if (x >= 0) "Yes" else "No")
    }
}

// Input Reader
private fun readLn() = readLine()!!

private fun readStrings() = readLn().trim().split(" ")
private fun readInts() = readStrings().map { it.toInt() }


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

#define ll long long int
#define ull unsigned long long int
#define db double
#define ld long double
#define MOD 1000000007
#define inf (1LL << 62)
#define pi acos(-1.0)
#define si(a) scanf("%lld",&a)
#define sd(n) scanf("%lf", &n)
#define for1(i, stop) for(ll i = 1; i <= stop; i++)
#define for0(i, stop) for(ll i = 0; i < stop; i++)
#define rep1(i, start) for(ll i = start; i >= 1; i--)
#define rep0(i, start) for(ll i = (start-1); i >= 0; i--)
#define loop(i, start, stop, inc) for(ll i = start; i <= stop; i += inc)
#define pb(v,a) v.push_back(a)
#define pll pair <ll, ll>
#define mp make_pair
#define pbp(v,a,i) v.push_back(make_pair(a,i))
#define srt(v) sort(v.begin(),v.end())
#define rv(v) reverse(v.begin(),v.end())
#define ms(n, i) memset(n, i, sizeof(n))
#define debug printf("Debug\n");
#define en '\n'



#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
/*typedef tuple<ll,ll,ll>tpl;

ll bigmod(ll n,ll pow)
{
    if(pow==0)
        return 1;
    if(pow==1)
        return n%MOD;

    ll ans=bigmod(n,pow/2);
    ans=(ans*ans)%MOD;

    if(pow%2==1)
    {
        ans=(ans*n)%MOD;
    }
    return ans%MOD;
}

ll fact[1000005];

ll nCr(ll n,ll r)
{

    ll ans=fact[n];
    ans=(ans*bigmod(fact[r],MOD-2))%MOD;
    ans=(ans*bigmod(fact[n-r],MOD-2))%MOD;
    return ans;
} */

int main()
{
    _fastio
   ll x,k,d;
   cin>>x>>k>>d;
   if(x>0)
   {
    ll t=(x/d);
    if(t<=k)
    {
      k=k-t;
      
      ll a=(x%d);
      ll b=a-d;

      if(k%2==0) cout<<abs(a)<<en;
      else cout<<abs(b)<<en;
    }
    else cout<<x-(k*d)<<en;
   }
   else if(x<0)
   {
    ll y=abs(x);
    ll t=(y/d);
    if(t<=k) 
    {
      k=k-t;

      ll a=-(y%d);
      ll b=a+d;

      if(k%2==0) cout<<abs(a)<<en;
      else cout<<abs(b)<<en;
    }
    else cout<<abs(x+(k*d))<<en;
   }
   else
   {
    if(k%2==0)
        cout<<"0"<<en;
    else
        cout<<abs(x-d)<<en;
   }
}


Measured memory_bytes: 3604
//template code, C343, 2019
import java.util.*;

class Graph2 {
	private int totalVertex;
	private LinkedList<LinkedList<Integer>> adjList;
	private int[] discoverTime;
	private int[] finishTime;
	private int searchTime;
	//adjacency list of edges
	public Graph2() { totalVertex = 0; searchTime = 1;}
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjList = new LinkedList<LinkedList<Integer>>();
		discoverTime = new int[totalVertex];
		finishTime = new int[totalVertex];
		for(int i = 0; i < totalVertex; i ++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			int idx1 = in.nextInt() - 1;
			int degree = in.nextInt();
			//System.out.println("mark idx1 = " + idx1 + " degree = " + degree);
			for(int j = 0; j < degree; j ++) {
				int idx2 = in.nextInt() - 1;
				tmp.add(idx2);
			}	
			adjList.add(tmp);
		}
		in.close();
	}
	public void printAdjMatrix() {
		Integer[][] adjMatrix = new Integer[totalVertex][totalVertex];
		Iterator<LinkedList<Integer>> it = adjList.iterator();
		int x = 0;
		while(it.hasNext()) {
			LinkedList<Integer> curr = it.next();
			Iterator<Integer> it2 = curr.iterator();
			while(it2.hasNext()) {
				adjMatrix[x][it2.next()] = 1;
			}
			x++;
		}
		for(int i = 0; i < totalVertex; i++) {
			String temp = "";
			for(int j = 0; j < totalVertex; j++) {
				if(adjMatrix[i][j] == null) {
					temp += "0 ";
				}
				else {
					temp += "1 ";
				}
			}
			System.out.println(temp.substring(0, temp.length() - 1));
		}
	}
	
	public void dfs(int n) {
		discovered(n);
		LinkedList<Integer> curr = adjList.get(n);
		for(int x: curr) {
			if(discoverTime[x] == 0) {
				dfs(x);
			}
		}
		finished(n);
	}
	
	public void discovered(int n) {
		discoverTime[n] = searchTime;
		searchTime++;
	}
	
	public void finished(int n) {
		finishTime[n] = searchTime;
		searchTime++;
	}
	
	public void searchResults() {
		for(int i = 0; i < totalVertex; i++) {
			if(discoverTime[i] == 0) {
				dfs(i);
			}
			System.out.println((i + 1) + " " + discoverTime[i] + " " + finishTime[i]);
		}
	}
}

public class Main {
	public static void main(String[] args) {
		Graph2 g = new Graph2();
		g.loadAdjList();
		g.searchResults();
	}
}



Measured memory_bytes: 28324
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
 
#define P pair<lli,lli>
 
signed main(){
 
	lli x,y;
	cin>>x>>y;
 
	lli cnt=0;
	while(x<=y){
		x*=2;
		cnt++;
	}
	cout<<cnt<<endl;
 
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> X(N), Y(N);
	for (int i = 0; i < N; ++i) {
		cin >> X[i] >> Y[i];
	}
	vector<int> gx = X, gy = Y;
	sort(gx.begin(), gx.end());
	gx.erase(unique(gx.begin(), gx.end()), gx.end());
	sort(gy.begin(), gy.end());
	gy.erase(unique(gy.begin(), gy.end()), gy.end());
	int sx = gx.size(), sy = gy.size();
	vector<vector<int> > G(sx + sy);
	for (int i = 0; i < N; ++i) {
		int px = lower_bound(gx.begin(), gx.end(), X[i]) - gx.begin();
		int py = lower_bound(gy.begin(), gy.end(), Y[i]) - gy.begin();
		G[px].push_back(py + sx);
		G[py + sx].push_back(px);
	}
	vector<bool> vis(sx + sy, false);
	int cx = 0, cy = 0;
	function<void(int) > dfs = [&](int pos) {
		vis[pos] = true;
		if (pos < sx) ++cx;
		else ++cy;
		for (int i : G[pos]) {
			if (vis[i]) continue;
			dfs(i);
		}
	};
	long long ans = 0;
	for (int i = 0; i < sx + sy; ++i) {
		if (!vis[i]) {
			cx = 0, cy = 0;
			dfs(i);
			ans += 1LL * cx * cy;
		}
	}
	cout << ans - N << endl;
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
using ll = long long;

using namespace std;

int main(void){
  ll a, b, k;
  cin >> a >> b >> k;

  if(a >= k){
    a -= k;
    cout << a << " " <<  b << endl;
  }else{
    k -= a;
    a = 0;
    b -= k;
    if(b < 0) b = 0;
    cout << a << " " << b << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a, b, c;
	
	scanf("%d %d %d", &a, &b, &c);
	
	if(a < b && b < c){
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	
	return (0);
}

Measured memory_bytes: 580
n = int(input())
w = [input() for i in range(n)]

# 重複
if len(set(w))!=n:
    print("No")
    exit()

# 前の末尾が次の先頭
for i in range(1,n):
    if w[i-1][-1]!=w[i][0]:
        print("No")
        exit()

print("Yes")

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

int main() {
    int N,L;
    cin >> N >> L;
    string list[101];
    for(int i = 0; i<N;i++) {
        cin >> list[i];
    }
    sort(list, list + N);
    string max = "";
    for(int i = 0; i<N; i++ ) {
        max += list[i];
    }
    cout << max << endl;
}

Measured memory_bytes: 256
n, *p_n = map(int, open(0).read().split())

count = 0
p_n_min = p_n[0]
for i in range(n):
    p_n_min = min(p_n_min,p_n[i])
    if p_n_min == p_n[i]:
        count += 1
print(count)

Measured memory_bytes: 25116
import math
import sys


def get_triangle_area(x1, y1, x2, y2, x3, y3):
    l1 = math.sqrt(abs(x1-x2)**2+abs(y1-y2)**2)
    l2 = math.sqrt(abs(x2-x3)**2+abs(y2-y3)**2)
    l3 = math.sqrt(abs(x3-x1)**2+abs(y3-y1)**2)
    s = (l1+l2+l3)/2
    return math.sqrt(s*(s-l1)*(s-l2)*(s-l3))


for l in sys.stdin:
    x1, y1, x2, y2, x3, y3, xp, yp = map(float, l.split())
    s1 = get_triangle_area(x1, y1, x2, y2, x3, y3)
    s2 = get_triangle_area(xp, yp, x1, y1, x2, y2)
    s2 += get_triangle_area(xp, yp, x2, y2, x3, y3)
    s2 += get_triangle_area(xp, yp, x3, y3, x1, y1)
    print("YES" if round(s1, 5) == round(s2, 5) else "NO")

Measured memory_bytes: 7620
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.SoundHound2018
{
    class SH_2018_C
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int m = int.Parse(input[1]);
            int d = int.Parse(input[2]);

            int pats =0;
            if (d == 0)
            {
                pats = n;
            }
            else
            {
                pats = 2 * (n - d);
            }
            double val = (double)pats * (m - 1) / n / n;
            Console.WriteLine(val);

            /*long lim = (long)Math.Pow(n, m);
            long num1 = 0, num2 = 0;
            int allKirei = 0;
            for (long i = 0; i < lim; i++)
            {
                long num = i;
                string s = "";
                int kirei = 0;
                for (int j = 0; j < m; j++)
                {
                    if (j == 0)
                    {
                        num1 = num % n + 1;
                    }
                    else
                    {
                        num2 = num % n + 1;
                        if (Math.Abs(num1 - num2) == d)
                        {
                            kirei++;
                        }
                        num1 = num2;
                    }
                    s += num1.ToString();
                    num /= n;
                }
                s += " " + kirei.ToString();
                Console.WriteLine(s);
                allKirei += kirei;
            }
            Console.WriteLine(allKirei);
            */
        }
    }
}


Measured memory_bytes: 13140
/*
 * b.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_H = 50;
const int MAX_W = 50;
const int MAX_N = 100;

const int INF = 1 << 30;

/* typedef */

typedef unsigned long long ull;

/* global variables */

int asums[MAX_H + 1][MAX_W + 1];
ull bs[MAX_H], cs[MAX_H];

/* subroutines */

/* main */

int main() {
  int h, w;
  cin >> h >> w;

  for (int y = 0; y < h; y++)
    for (int x = 0; x < w; x++) {
      int a;
      cin >> a;
      asums[y + 1][x + 1] =
	a + asums[y + 1][x] + asums[y][x + 1] - asums[y][x];
    }

  for (int y = 0; y < h; y++)
    for (int x = 0; x < w; x++) {
      int b;
      cin >> b;
      if (b) bs[y] |= (1ULL << x);
    }

  int ch, cw;
  cin >> ch >> cw;

  for (int y = 0; y < ch; y++)
    for (int x = 0; x < cw; x++) {
      int c;
      cin >> c;
      if (c) cs[y] |= (1ULL << x);
    }

  ull mask = (1ULL << cw) -1;
  int maxsum = -INF;

  int dh = h - ch, dw = w - cw;
  for (int y = 0; y <= dh; y++)
    for (int x = 0; x <= dw; x++) {
      bool match = true;
      for (int cy = 0; cy < ch; cy++)
	if (((bs[y + cy] >> x) & mask) != cs[cy]) {
	  match = false;
	  break;
	}

      if (match) {
	int sum =
	  asums[y + ch][x + cw]
	  - asums[y][x + cw] - asums[y + ch][x] + asums[y][x];
	if (maxsum < sum) maxsum = sum;
      }
    }

  if (maxsum <= -INF) puts("NA");
  else printf("%d\n", maxsum);
  return 0;
}


Measured memory_bytes: 1156
use std::collections::VecDeque;

const INF: u64 = 1e15 as u64;
const D: [(i64, i64); 4] = [(0, -1), (0, 1), (1, 0), (-1, 0)];

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let h: usize = sc.read();
    let w: usize = sc.read();
    let a: Vec<Vec<char>> = (0..h).map(|_| sc.chars()).collect();
    let mut dist = vec![vec![INF; w]; h];
    let mut q = VecDeque::new();
    for i in 0..h {
        for j in 0..w {
            if a[i][j] == '#' {
                q.push_back((i, j));
                dist[i][j] = 0;
            }
        }
    }

    while let Some((i, j)) = q.pop_front() {
        for &(di, dj) in D.iter() {
            let ni = di + (i as i64);
            let nj = dj + (j as i64);
            if ni < 0 || nj < 0 {
                continue;
            }
            let ni = ni as usize;
            let nj = nj as usize;
            if ni >= h || nj >= w {
                continue;
            }

            if dist[ni][nj] > dist[i][j] + 1 {
                dist[ni][nj] = dist[i][j] + 1;
                q.push_back((ni, nj));
            }
        }
    }

    let max = dist
        .into_iter()
        .map(|d| d.into_iter().max().unwrap())
        .max()
        .unwrap();
    println!("{}", max);
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 31992
#include <iostream>

int main()
{
    int wid, known;
    std::cin >> wid >> known;
    int min = known - wid + 1;
    int max = known + wid - 1;
    for(int i = min; i <= max; i++)
    {
        std::cout << i << " ";
    }

    return 0;
}

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

int main(void) {
	int temp, size, firstpoint, quest;
	cin >> size >> firstpoint >> quest;
	vector<int> vec(size);

	for (int i = 0; i < quest; i++) {
		cin >> temp;
		vec.at(temp-1)++;
	}
	if (firstpoint - quest > 0) { for (int i = 0; i < size; i++) cout << "Yes" << endl; return 0; }

	for (int i = 0; i < size; i++) {
		if (vec.at(i) + firstpoint - quest > 0) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
using namespace std;
int N, i;

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

  cin >> N >> i;

  cout << N - i + 1<< endl;

  return 0;
}

Measured memory_bytes: 256
n=gets.to_i
a=Array.new(n) 
a=gets.split.map(&:to_i)
sum=0
for i in 0..n-1
	sum=sum+a[i]
end

mindiff=10000000000
sunuke=a[0]
tanuki=sum-a[0]
for i in 0..n-2
	diff=sunuke-tanuki
	if diff.abs<mindiff
		mindiff=diff.abs
	end
	sunuke=sunuke+a[i+1]
	tanuki=tanuki-a[i+1]
end
puts mindiff

Measured memory_bytes: 16772
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {
    ll n;
    ll d[100010];
    std::cin >> n;
    for (int i = 0; i < n; i++) {
        std::cin >> d[i];
    }
    sort(d,d+n);
    ll a = d[n/2-1];
    ll b = d[n/2];
    std::cout << b-a << std::endl;
}


Measured memory_bytes: 1024
#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 all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
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 const INF = 1001001001;


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

int ans = 0;
rep(i,4) {
    char c;
    cin >> c;
    if(c == '+') ans++;
    else ans--;
}
cout << ans << endl;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define REP(N) for(ll i = 0; i < N;++i) 
#define REP(i,N) for(ll i = 0; i < N;++i) 

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
int main(){
  ll N,K;
  cin>>N>>K;
  vector<ll> Su(N,0);
  REP(i,K){
    ll d;
    cin>>d;
    REP(j, d){
      ll tmp;
      cin>>tmp;
      Su[tmp-1]++;
    }
  }
  ll sum = 0;
  REP(i,N){
    if(Su[i] == 0) sum++;
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 3628
#include<stdio.h>
#include<string.h>

int main()
{
    int n,a=1;
    scanf("%d",&n);
    char s[n];
    for(int i=0;i<n;i++)
    {scanf("%s",&s[i]);}
    for(int i=0;i<n-1;i++)
    {if(s[i]!=s[i+1])
    {a++;}
    }
    printf("%d",a);
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main(){
    ll n; cin>>n;
    vector<ll> v={2,1};
    rep(i,n-1){
        v.push_back(v[i]+v[i+1]);
    }
    cout<<v[n]<<endl;
    return 0;
}

Measured memory_bytes: 256
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var n int
    fmt.Scan(&n)
    ans := "No"
    k := 0
    m := n
    for m>0{
        k += m%10
        m/=10
    }
    if n%k == 0{
        ans = "Yes"
    }
    fmt.Println(ans)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func SortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main () {
    int N; cin >> N;
    map<int, int> X;
    rep(i, N) {
        int a; cin >> a;
        X[a]++;
        X[a+1]++;
        X[a-1]++;
    }
    int ans = 0;
    for (auto i : X) {
        ans = max(ans, i.second);
    }
    cout << ans << endl;
}

Measured memory_bytes: 4736
def two(m, n, x):
    # ok if i+j=x, m<=i<j<=n                                                                                                                                                                                
    # j = x-i                                                                                                                                                                                               
    ans = 0   
    for i in range(m, n+1):
        j = x - i
        if i < j and j <= n:
            ans += 1
    return ans
              
while True:   
    n, x = map(int, input().split())
    if n == 0 and x == 0:
        break 
    ans = 0   
    for i in range(1, n+1):
        ans += two(i+1, n, x-i)
    print(ans)


Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll x,ll y){
    if (y == 0) return x;
    return gcd(y, x%y);
}
ll lcm(ll x,ll y){
    return x*y/gcd(x,y);
}
int main(void){
    ll n,m;cin>>n>>m;
    vector<ll> b(n);
    ll xx=-1;
    ll y;cin>>y;
    b[0]=y/2;
    while(y>0){
        if(y%2==1){
            xx=b[0]*2/y;
            break;
        }
        y/=2;
    }
    for(int i=1;i<n;i++){
        ll x;cin>>x;
        b[i]=x/2;
        if((x/xx)%2==0){
            cout<<0<<endl;
            return 0;
        }
    }
    ll L=b[0];
    for(int i=1;i<n;i++){
        L=lcm(L,b[i]);
        
    }
    m/=L;
    ll res=(m+1)/2;
    cout<<res<<endl;
}


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

int main(){
    int N,l,r;
    
    cin >> N;
    vector<int> v(N),v2(N);
    for (int i=0;i<N;i++){
        cin >> v[i];
        v2[i] = v[i];
    }

    sort(v.begin(),v.end());
    l = v[N/2-1];
    r = v[N/2];

    for (int k:v2){
        if (k<=l){
            cout << r << endl;
        }
        else {
            cout << l << endl;
        }
    }
}


Measured memory_bytes: 3712
///in the name of Allah the most beneficent the most merciful.
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define MAX 1e18
#define MIN -1e18
#define MOD 1000000007
//#define mod2 20071027
//#define MOD 998244353
#define base 139
//#define mod 1000074259
#define base2 31
#define memz(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define in1(a) scanf("%lld", &a)
#define in2(a, b) scanf("%lld%lld", &a, &b)
#define TC(c) printf("Case #%lld: ", ++c)
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FILE   freopen("input.txt", "r", stdin);  freopen("out.txt", "w", stdout);
#define out(x) cout << #x << " -> " << x << endl;
using namespace std;
const ll N = 200010, M = 2000005;
ll n, m, a, freq[N], sum;
int solve()
{
    in1(n);
    for (int i = 0; i < n; i++)
    {
        in1(a);
        freq[a]++;
        sum += a;
    }
    in1(m);
    while (m--)
    {
        ll b;
        in2(a, b);
        sum = sum - (freq[a] * a) + ( freq[a]* b);

        freq[b] += freq[a];
        freq[a] = 0;
        printf("%lld\n", sum);
    }
    return 0;
}
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int ret = solve();
    return 0;
}
/*

*/


Measured memory_bytes: 4412
a, b, c, x, y = map(int, input().split())
min_sum = 0

if (a + b) > (c * 2):
    if x > y:
        min_sum = y * (c * 2)
        if a > (c * 2):
            min_sum += (x - y) * (c * 2)
        else:
            min_sum += (x - y) * a
    else:
        min_sum = x * (c * 2)
        if b > (c * 2):
            min_sum += (y - x) * (c * 2)
        else:
            min_sum += (y - x) * b
else:
    min_sum = a * x + b * y

print(min_sum)


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

int main()
{
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    // 1往復目
    //// 行き
    for( int i = 0; i < ty-sy; ++i ) cout << "U";
    for( int i = 0; i < tx-sx; ++i ) cout << "R";
    //// 帰り
    for( int i = 0; i < ty-sy; ++i ) cout << "D";
    for( int i = 0; i < tx-sx; ++i ) cout << "L";

    // 2往復目
    //// 行き
    cout << "LU";
    for( int i = 0; i < ty-sy; ++i ) cout << "U";
    for( int i = 0; i < tx-sx; ++i ) cout << "R";
    cout << "RD";
    //// 帰り
    cout << "RD";
    for( int i = 0; i < ty-sy; ++i ) cout << "D";
    for( int i = 0; i < tx-sx; ++i ) cout << "L";
    cout << "LU" << endl;

    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <numeric>

using namespace std;

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

int main() {
    vector< vector<int> > v;
    REP(i,3) {
        int a, b, c;
        cin >> a >> b >> c;
        vector<int> u{a, b, c};
        v.push_back(u);
    }

    bool f = false;
    REP(i, *min_element(ALL(v[0])) +1) {
        REP(j, *min_element(ALL(v[1])) +1) {
            int b1 = v[0][0] - i,
                b2 = v[0][1] - i,
                b3 = v[0][2] - i;
            if (b1+j != v[1][0] || b2+j != v[1][1] || b3+j != v[1][2]) continue;
            REP(k, *min_element(ALL(v[2])) +1) {
                if (b1+k != v[2][0] || b2+k != v[2][1] || b3+k != v[2][2]) continue;
                else {
                    f = true;
                    break;
                }
            }
            if(f) break;
        }
        if(f) break;
    }

    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

using namespace std;

const int N = 105;

int n, m, a[N];
int s = 0;
int main() {
	scanf("%d%d", &n, &m);

	for (int i = 1; i <= n; i++) scanf("%d", a + i), s += a[i];
	int cnt = 0;
	for (int i = 1; i <= n; i++) {
		if (a[i] >= (double)s / 4 / m) cnt++;
	}
	puts(cnt >= m ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	double a,b,f;
	int c,d;
	scanf("%lf %lf",&a,&b);
	c =(int)( a/b);
	d = (int)a%(int)b;
	f = a/b;
	printf("%d %d %f\n",c,d,f);
	return 0;
}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define FORD(i,b,a) for (int i = (int)(b) - 1; i >= a; --i)
#define REP(i,N) FOR(i,0,N)
#define st first
#define nd second
#define pb push_back

typedef pair<int, int> PII;
typedef long long LL;

LL A[222222];
vector<int> adj[222222];

bool go(int v, int p = -1) {
  LL su = 0;
  for (int u: adj[v]) if (u != p) {
    bool r = go(u,v);
    if (r) continue;
    if (A[u] < A[v]) return true;
  }
  return false;
}

int main() {
  int N;
  scanf("%d", &N);
  REP(i,N) scanf("%lld", &A[i]);
  REP(i,N-1) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    adj[a].pb(b);
    adj[b].pb(a);
  }
  REP(i,N) {
    if (go(i)) {
      printf("%d ", i+1);
    }
  }
  printf("\n");
}


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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template<typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template<typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if (i) os << " ";
    os << v[i];
  }
  return os;
}

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

  int n;
  cin >> n;
  int tmp = 1;
  while (tmp < n) tmp *= 2;
  if (tmp == n) {
    cout << "No" << endl;
    return 0;
  }

  cout << "Yes" << endl;
  if (n % 2) {
    vector<bool> sel(n, false);
    bool one = false;
    FOR(i, 2, n + 1) {
      if (sel[i]) continue;
      int j = i ^1;
      sel[i] = true;
      sel[j] = true;
      cout << i << " " << j << endl;
      cout << j << " " << 1 << endl;
      cout << "1 " << i + n << endl;
      cout << i + n << " " << j + n << endl;

      if (!one) {
        cout << 1 + n << " " << i << endl;
        one = true;
      }
    }
  } else {
    int idx = n ^ 1;
    vector<bool> sel(n, false);
    vector<bool> beg(n, false);
    bool one = false;
    FOR(i, 2, n) {
      if (sel[i]) continue;
      beg[i] = true;
      int j = i ^1;
      sel[i] = true;
      sel[j] = true;
      cout << i << " " << j << endl;
      cout << j << " " << 1 << endl;
      cout << 1 << " " << i + n << endl;
      cout << i + n << " " << j + n << endl;
      if(!one) {
        cout << 1 + n << " " << i << endl;
        one = true;
      }
    }
    FOR(i, 2, n) {
      if(i == idx) continue;
      int j = idx ^ i;
      if(j != i && j < n) {
        cout << n << " " << (beg[i] ? i+n : i) << endl;
        cout << 2*n << " " << (beg[j] ? j+n : j) << endl;
        break;
      }
    }
  }


}








Measured memory_bytes: 3660
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace AtCoder {
    class Practice {
        static void Main() => CustomMain();

        static void Solve() {
            var ary = ReadIntArray();
            var a = ary[0];
            var b = ary[1];

            WriteAnswer(b < a ? a - 1 : a);
        }


        static void CustomMain() {
#if DEBUG
            // ファイルからテストケースを読み込む
            global::Common.ChangeStdIn();
            // 時間計測
            var stopwatch = new Stopwatch();
            stopwatch.Start();
#endif
            // 出力高速化
            var streamWriter = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
            Console.SetOut(streamWriter);
            // 回答
            Solve();
#if DEBUG
            stopwatch.Stop();
            Console.WriteLine(stopwatch.Elapsed);
#endif
            Console.Out.Flush();
        }

        static string ReadString() => Console.ReadLine().Trim();
        static int ReadInt() => int.Parse(ReadString());
        static long ReadLong() => long.Parse(ReadString());
        static float ReadFloat() => float.Parse(ReadString());
        static double ReadDouble => double.Parse(ReadString());

        static string[] ReadStringArray() => ReadString().Split(' ');
        static int[] ReadIntArray() => Array.ConvertAll(ReadString().Split(' '), int.Parse);
        static long[] ReadLongArray() => Array.ConvertAll(ReadString().Split(' '), long.Parse);
        static float[] ReadFloatArray() => Array.ConvertAll(ReadString().Split(' '), float.Parse);
        static double[] ReadDoubleArray() => Array.ConvertAll(ReadString().Split(' '), double.Parse);

        static T TypeConversion<T>(string s) {
            if (typeof(T) == typeof(int)) {
                return (T) Convert.ChangeType(int.Parse(s), typeof(T));
            } else if (typeof(T) == typeof(long)) {
                return (T) Convert.ChangeType(long.Parse(s), typeof(T));
            } else if (typeof(T) == typeof(double)) {
                return (T) Convert.ChangeType(double.Parse(s), typeof(T));
            } else {
                return (T) Convert.ChangeType(s, typeof(T));
            }
        }

        static void ReadMulti<T, U>(out T a, out U b) {
            var str = ReadStringArray();
            a = TypeConversion<T>(str[0]);
            b = TypeConversion<U>(str[1]);
        }

        static void ReadMulti<T, U, V>(out T a, out U b, out V c) {
            var str = ReadStringArray();
            a = TypeConversion<T>(str[0]);
            b = TypeConversion<U>(str[1]);
            c = TypeConversion<V>(str[2]);
        }

        static void WriteAnswer(object ans) => Console.WriteLine(ans);

        static bool IsOdd(long num) {
            return (num & 1) == 1;
        }

        static bool IsEven(long num) {
            return (num & 1) == 0;
        }

        static long GCD(long a, long b) {
            return b != 0 ? GCD(b, a % b) : a;
        }
    }
}

Measured memory_bytes: 11092
{-# LANGUAGE BangPatterns #-}
import Control.Arrow
import Control.Monad.Fix
import Data.Foldable
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VM
import qualified Data.ByteString.Char8 as B
import System.IO.Unsafe
import Debug.Trace

--solve :: Int -> Int -> B.ByteString -> Int
solve n k ss = maximum
  [ accums
    VU.! ((i + k') `min` (gn - 1))
    -    (if i - k' - 1 >= 0 then accums VU.! (i - k' - 1) else 0)
  | i <- [0 .. gn - 1]
  , let k' =
          if is0AtNthGroup i then ((k - 1) `div` 2) * 2 + 1 else (k `div` 2) * 2
  ]
 where
  bss = unsafePerformIO $ VU.freeze $ fst $ B.foldl'
    ( \(acc, i) ch ->
      (unsafePerformIO $ VM.write acc i (ch == '1') >> return acc, i + 1)
    )
    (unsafePerformIO $ VM.new n, 0)
    ss

  (_, irevstream, gn) = fix
    ( \f (bs, acc, g) -> if VU.length bs == 0
      then (bs, acc, g)
      else if not (VU.head bs)
        then
          let (zeros, other) = VU.span not bs
          in  f (other, VU.length zeros : acc, g + 1)
        else
          let (ones, other) = VU.span id bs
          in  f (other, VU.length ones : acc, g + 1)
    )
    (bss, [], 0)

  accums :: VU.Vector Int
  accums = unsafePerformIO $ VU.freeze $ (\(x, _, _) -> x) $ foldr'
    ( \k (acc, i, prev) ->
      let cur = prev + k
      in  cur
            `seq` ( unsafePerformIO $ (VM.write acc i cur >> return acc)
                  , i + 1
                  , cur
                  )
    )
    (unsafePerformIO $ VM.new gn, 0, 0)
    irevstream

  is0AtNthGroup n = if not (VU.head bss) then even n else odd n

main = do
  let readInt = fmap (second B.tail) . B.readInt

  nk <- V.unfoldrN 2 readInt <$> B.getLine

  ss <- B.getLine
  print $ solve (nk V.! 0) (nk V.! 1) ss


Measured memory_bytes: 23932
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		PriorityQueue<Double> queue = new PriorityQueue<>();
		for (int i = 0; i < n; i++) {
		    queue.add(sc.nextDouble());
		}
		while (queue.size() > 1) {
		    double a = queue.poll();
		    double b = queue.poll();
		    queue.add((a + b) / 2);
		}
		System.out.println(queue.poll());
	}
}


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

using namespace std;

#define ll long long

const ll mod  = 1e9 + 7;
const ll INF = 1e14;

int dfs(vector<int> graph[], vector<bool>& vis, int node){
    vis[node] = true;
    int res = 1;
    for(int it : graph[node]){
        if(vis[it]) continue;
        res += dfs(graph, vis, it);
    }
    return res;
}

void solve(){

    int n, m; cin >> n >> m;
    vector<int> graph [n];
    while(m--){
        int u, v; cin >> u >> v; --u, --v;
        graph[u].push_back(v);
        graph[v].push_back(u);
    }

    vector<bool> vis (n, false);
    int ans = 0;
    for(int i = 0; i < n; ++i){
        if(vis[i]) continue;
        ans = max(ans, dfs(graph, vis, i));
    }
    cout << ans;

}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    //int test; cin >> test;
    //for(int t = 1; t <= test; ++t){
        solve();    
    //}

	return 0;
}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair< int, int> P;
struct edge{ll to, cost; };

static const double EPS = 1e-8;
static const double PI = 3.141592653589;
static ll INF = 999999999999;
int mod = 1000000007;

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define MIN(a,b)    (a) < (b) ? (a):(b)
#define MAX(a,b)    (a) > (b) ? (a):(b)
#define debug(x) cerr << #x << " = " << x << endl;
int dx[] = {1,-1,0,0,1,-1,1,-1};
int dy[] = {0,0,1,-1,-1,1,1,-1};

using namespace std;


int f(int b, int n){
    if(n < b)return n;

    return f(b, (n / b)) + (n % b);
}




int main() {

    int a, b, h;
    cin >> a;
    cin >> b;
    cin >> h;
    h = h / 2;


    cout << (a + b) * h << endl;

    return 0;
}

Measured memory_bytes: 256
NW = list(map(int,input().split()))
N,W = NW[0],NW[1]
wv = [map(int,input().split()) for _ in range(N)]
w,v = [list(i) for i in zip(*wv)]
dp = [[0]*(W+1) for _ in range(N+1)]#初期値は入力済み
ans = 0
for i in range(1,N+1):
    for j in range(1,W+1):
        if j-w[i-1] < 0:
            dp[i][j] = dp[i-1][j]
            ans = max(ans,dp[i][j])
        else:
            dp[i][j] = max(dp[i-1][j-w[i-1]]+v[i-1],dp[i-1][j])
            ans = max(ans,dp[i][j])
print(ans)


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

double const pi = 3.1415926535;
int const mod = 1000000007;
int const inf = 2147483647;

int yesno(bool f, string yes, string no) {
	if (f)cout << yes << endl;
	else cout << no << endl;
	return 0;
}

int printint(int n) {
	cout << n << endl;
	return 0;
}

int prints(string s) {
	cout << s << endl;
	return 0;
}

int main() {

	int n;
	cin >> n;
	printint(n / 3);

	return 0;
}

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

namespace ABC059Sequence
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            long[] a = new long[n];
            long[] b = new long[n];
            string[] vals = Console.ReadLine().Split(' ');

            for (int i = 0; i < n; i++)
            {
                a[i] = long.Parse(vals[i]);
                b[i] = a[i];
            }

            long m = 0;
            long num1, num2;
            if(a[0] <= 0)
            {
                m = a[0] * -1 + 1;
                a[0] += m;
            }
            num1 = calc(a) + m;

            m = 0;
            if(b[0] >= 0)
            {
                m = b[0] + 1;
                b[0] -= m;
            }
            num2 = calc(b) + m;

            Console.WriteLine(Math.Min(num1, num2));
        }

        static long calc(long[] a)
        {
            long num = 0;
            int n = a.Length;

            long[] cum = new long[n + 1];
            for (int i = 1; i < n; i++)
            {
                cum[i] = cum[i - 1] + a[i - 1];
                long t;
                if (cum[i] > 0)
                {
                    t = cum[i] * -1 - 1;
                }
                else
                {
                    t = cum[i] * -1 + 1;
                }

                //Console.WriteLine("target: {0}", t);

                long u;
                if (t > 0)
                {
                    if (a[i] < t)
                    {
                        u = t - a[i];

                        //Console.WriteLine("u={0}", u);
                        a[i] += u;
                        num += u;
                    }
                }
                else
                {
                    if (a[i] > t)
                    {
                        u = a[i] - t;
                        //Console.WriteLine("u=-{0}", u);

                        a[i] -= u;
                        num += u;
                    }
                }
            }

            return num;
        }

    }
}


Measured memory_bytes: 31708
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repn(i,n) for(int i = 0; i <= (int)(n); i++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define srepn(i,l,n) for(int i = l; i <= (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define drepn(i,n) for(int i = (int)(n); i >= 0; i--)
#define size(s) (int)s.size()
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ep emplace_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    while(1) {
        int nn = n;
        bool ok = true;
        for(int i = 2; i*i <= nn; i++) {
            if(nn%i==0) {
                ok = false;
                break;
            } 
        }
        if(ok) {
            cout << n << endl;
            return 0;
        }else{
            n++;
        }
    }

}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define eb emplace_back
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, r;
    cin >> n >> r;
    if (n >= 10) {
        cout << r << endl;
    } else {
        cout << r + 100 * (10 - n) << endl;
    }
}


Measured memory_bytes: 892
x, n = map(int, input().split())
p = list(map(int, input().split()))
a = 0
ans = ''
while ans == '':
  if len(p) == 0:
    ans = x
  elif x - a not in p:
    ans = x - a
  elif x + a not in p:
    ans = x + a
  else:
    a += 1
print(ans)

Measured memory_bytes: 9200
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <queue>
#include <stack>
#include <climits>
using namespace std;

typedef long long ll;
#define pb push_back

#define rep(i, n) for (int i=0;i<(n);++i)
#define rep2(i, s, n) for (int i=s;i<(n);++i)
#define rev(i, n) for (int i=(n);i>0;--i)
#define INF (1e9+1e9)

int main() {
    string s; cin>>s;
    int count = 0;
    rep(i,s.length()) if (s[i] == '1') count++;

    cout << count << endl;
}

Measured memory_bytes: 256