akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)

int hyou[40][40];
int hyou2[40][40];
int W,H;
int cnt;


int main() {
	while(cin >> W >> H , W) {
		rep(i, 35) {
			rep(j, 35){
				hyou[i][j] = 0;
				hyou2[i][j] = 0;
			}
		}
		int c;
		rep(i, H * 2 - 1) {
			int h = i / 2 + 1;
			if (i % 2 == 0) {
				rep(w, W - 1) {
					cin >> c;
					if (c == 0) {
						hyou[h][w + 1] += 1;
					}
				}
			} else {
				rep(w, W) {
					cin >> c;
					if (c == 0) {
						hyou[h][w + 1] += 2;
					}
				}
			}
		}
		
		int Q[100000][2];
		int p = 0;
		int t = 1;
		Q[0][0] = 1;
		Q[0][1] = 1;
		hyou2[1][1] = 1;
		while (t > p) {
			int x = Q[p][0];
			int y = Q[p][1];
			int cnt = hyou2[y][x];
			p++;
			if (hyou[y][x] & 1) {
				if(hyou2[y][x + 1] == 0) {
					hyou2[y][x + 1] = cnt + 1;
					Q[t][0] = x + 1;
					Q[t][1] = y;
					t++;
				}
			}
			
			if (hyou[y][x - 1] & 1) {
				if(hyou2[y][x - 1] == 0) {
					hyou2[y][x - 1] = cnt + 1;
					Q[t][0] = x - 1;
					Q[t][1] = y;
					t++;
				}
			}
			
			if (hyou[y][x] & 2) {
				if(hyou2[y + 1][x] == 0) {
					hyou2[y + 1][x] = cnt + 1;
					Q[t][0] = x;
					Q[t][1] = y + 1;
					t++;
				}
			}
			if (hyou[y - 1][x] & 2) {
				if(hyou2[y - 1][x] == 0) {
					hyou2[y - 1][x] = cnt + 1;
					Q[t][0] = x;
					Q[t][1] = y - 1;
					t++;
				}
			}
		}
		cout << hyou2[H][W] << endl;
	}
}




Measured memory_bytes: 3028
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int n = sc.nextInt();
		int[] array = new int[n];
		int[] d = new int[102];
		for(int i=0; i<d.length; i++) {
			d[i] = i;
		}
		for(int i=0; i<array.length; i++) {
			array[i] = sc.nextInt();
			d[array[i]] = -1;
		}

		int min = 9999;
		int result = 0;

		if(n == 0) {
			 result = x;
		}
		for(int i=0; i<102; i++) {
			if(d[i] != -1) {
				if(Math.abs(x - i) < min) {
					result = i;
					min = Math.abs(x - i);
				}
			}
		}

		System.out.println(result);
	}
}


Measured memory_bytes: 35864
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
    int N,W;
    cin>>N>>W;
    vector<ll> w(N);
    vector<ll> v(N);
    for(int i=0;i<N;i++){
        cin>>w[i]>>v[i];
    }
    vector<vector<ll>> dp(N+1,vector<ll>(W+1,0));
    for(int i=1;i<=N;i++){
        for(int j=1;j<=W;j++){
            if(w[i-1]<=j){
                dp[i][j] = max(dp[i-1][j],v[i-1]+dp[i-1][j-w[i-1]]);
            }
            else{
                dp[i][j] = dp[i-1][j];
            }
        }
    }
    cout<<dp[N][W];
}

Measured memory_bytes: 80256
using System;
class p
{
  static void Main()
  {
    string A = Console.ReadLine();
    string B = Console.ReadLine();
    
    if (A.Length == B.Length) {
      for (int i = 0; i < A.Length; i++) {
        if (A[i] == B[i]) {
          continue;
        } else {
          int a = int.Parse(A[i].ToString());
          int b = int.Parse(B[i].ToString());
          Console.WriteLine(a < b ? "LESS" : "GREATER");
          return;
        }
      }
      Console.WriteLine("EQUAL");
    } else {
      Console.WriteLine(A.Length < B.Length ? "LESS" : "GREATER");
    }
  }
}

Measured memory_bytes: 11092
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define vector2(a,b,c) vector<vector<int>> a(b/*縦！w*/,vector<int>(c/*横！w*/))
#define INF 1e10
#define MOD 1e9+7
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; }
using Graph = vector<vector<int>>;
signed main(){
  int a,b;
  cin>>a>>b;
  vector<int> c(a);
  rep(i,a)
    cin>>c[i];
  int e=0;
  rep1(i,a){
  /*if(c[i]<d){
    d+=b;
    e+=c[i]-c[i-1];
    }
    else{
      d=c[i]+b;
    e+=b;
    }*/
    e+=min(c[i]-c[i-1],b);
  }
  cout<<e+b<<endl;
}

Measured memory_bytes: 1792
// Package main provides
//
// File:  c.go
// Author: ymiyamoto
//
// Created on Sun Dec 23 00:23:03 2018
//
package main

import "fmt"

func main() {
	var S string
	var K int
	fmt.Scan(&S, &K)

	for i := 0; i < len(S) && i < K; i++ {
		if S[i] != '1' {
			fmt.Println(string(S[i]))
			return
		}
	}
	fmt.Println("1")
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
const int INF=0x3fffffff;
const ll MOD=1000000007;
const ll MODD=998244353;
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }

int main()
{
  ll N, M;
  double long sum=0.0, b;
  cin >> N >> M;
  vector<ll> A(N);
  rep(i, N) {cin >> A[i]; sum += A[i];}
  sort(A.begin(), A.end(), greater<ll>());
  b = sum/(4*M);
  rep(i, M){
    if(A[i] < b){
      cout << "No" << "\n";
      return(0);
    }
  }
  cout << "Yes" << "\n";
}

Measured memory_bytes: 256
//package atcoder;
 
import java.util.*;
//import java.math.BigDecimal;
 
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S = sc.next();
		String find = "ABC";
		int count = 0;
		if(S.contains(find)) {
			//count ++;
			for(int i=2;i<N;i++) {
				if(S.charAt(i-2)=='A'&&S.charAt(i-1)=='B'&&S.charAt(i)=='C') {
					count ++;
				}
			}
		}
		System.out.println(count);
		
	}
}

Measured memory_bytes: 23764
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<iostream>
#include<algorithm>
#define m(a,b) memset(a,b,sizeof(a));
using namespace std;
const int maxn = 1e5;
int father[maxn + 5];
int main(){
	int x,a,b,c;
	int ans = 0;
	cin >> a >> b >> c >> x;
	for(int i = 0;i<=c;i++){
		for(int j = 0;j<=b;j++){
			for(int k = 0;k<=a;k++){
				if(50*i+100*j+500*k==x)
					ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import copy

def chk():
    for i in range(n-1):
        if L[i][1:2] == L[i+1][1:2]:
            stri = i
            a = strL.index(L[i])
            b = strL.index(L[i+1])
            if a > b:
                print("Not stable")
                return
    print("Stable")

n = int(input())
L = ['' for i in range(n)]

x = input()
for i in range(n):
    L[i] = x.split()[i]
strL = copy.copy(L)

for i in range(n-1):
    sta = n-1
    end = i
    j = sta
    while not j == end: 
        if L[j][1:2] < L[j-1][1:2]:
            tmp = L[j-1]
            L[j-1] = L[j]
            L[j] = tmp
        j -= 1
print(*L)
chk()

L = copy.copy(strL)
for i in range(n-1):
    min = i
    for j in range(i+1,n):
        if L[j][1:2] < L[min][1:2]:
            min = j
    if min == i:
        pass
    else:
        tmp = L[i]
        L[i] = L[min]
        L[min] = tmp

print(*L)
chk()



Measured memory_bytes: 6348
s_1 = "dream"
s_2 = "dreamer"
s_3 = "erase"
s_4 = "eraser"

S = input()

while True:
  if S[-5:] == s_1:
    S = S[:-5]
  elif S[-7:] == s_2:
    S = S[:-7]
  elif S[-5:] == s_3:
    S = S[:-5]
  elif S[-6:] == s_4:
    S = S[:-6]
  else :
    break

if len(S) == 0:
  print("YES")
else:
  print("NO")



Measured memory_bytes: 3236
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N , M;
  cin >> N >> M;
  vector<vector<char>> data(N, vector<char>(N));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      cin >> data.at(i).at(j);
    }
  }
  vector<vector<char>> tada(M, vector<char>(M));
  for (int i = 0; i < M; i++) {
    for (int j = 0; j < M; j++) {
      cin >> tada.at(i).at(j);
    }
  }
  bool dandy = false;
  for(int i = 0; i < N - M + 1; i++){
    for(int j = 0; j < N - M + 1; j++){
      bool lady = true;
      for(int k = 0; k < M; k++){
        for(int l = 0; l < M; l++){
          if(data.at(i + k).at(j + l) != tada.at(k).at(l)){
            lady = false;
          }
        }
      }
      if (lady) {
        dandy = true;
      }
    }
  }
  if(dandy){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
N = int(input())
s = []
for i in range(N):
  s.append(int(input()))

s_ = [n for n in s if n% 10 != 0]

if len(s_) == 0:
  res = 0
else:
  res = sum(s)
  if res % 10 == 0:
    res -= min(s_)

print(res)

Measured memory_bytes: 3060
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int m = Integer.parseInt(sc.next());
    long[] price = new long[n];
    for(int i = 0; i < n; i++) {
      price[i] = Long.parseLong(sc.next());
    }
    PriorityQueue<Long> queue = new PriorityQueue<>(Collections.reverseOrder());
    for(int i = 0; i < n; i++) {
      queue.offer(price[i]);
    }
    long temp;
    for(int i = 0; i < m; i++) {
      temp = queue.poll() / 2;
      queue.offer(temp);
    }
    long sum = 0;
    for(int i = 0; i < n; i++) {
      sum += queue.poll();
    }
    System.out.println(sum);
  }
}


Measured memory_bytes: 48980
N = int(input())
A = list(map(int,input().split()))

flag = 0

for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            continue
        else:
            flag = 1 
            break

if flag == 0:
    print("APPROVED")
else:
    print("DENIED")


Measured memory_bytes: 2940
import java.util.*;
class Main{
 static public void main(String args[]){
	Scanner sc=new Scanner(System.in);
	Set<String> set=new HashSet<String>();
	
	int num=sc.nextInt();
	for(int i=0;i<=num;i++){
		String str=sc.nextLine();
		set.add(str);
	}
	System.out.println(set.size()-1);
 }
}

Measured memory_bytes: 79592
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    int n;cin>>n;
    double t,a;cin>>t>>a;
    vector<double> h(n);
    rep(i,n) cin>>h[i];
    int res=-1;double tmp=10000;
    rep(i,n){
        double now=t-h[i]*0.006;
        if(chmin(tmp,abs(a-now)))res=i;
    }
    cout<<res+1<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	long long int a;
	scanf("%lld",&a);
	if(a==2)
	{
		printf("1");
		return 0;
	}
	
	int count = 2;
	for(long long int i=2;i*i<=a-1;i++)
	{
		if((a-1)%i==0)
		{
			if(i*i==a-1) count++;
			else count +=2;
		}
	}
	
	for(long long int i=2;i*i<=a;i++)
	{
		if(a%i==0)
		{
			long long int b = a;
			while(b%i==0) b/=i;
			if(b%i==1) count++;
			
			if(i*i==a) continue;
			b = a;
			while(b%(a/i)==0) b/=(a/i);
			if(b%(a/i)==1) count++;
		}
	}
	printf("%d",count);
}

Measured memory_bytes: 128
n,k=map(int,input().split())
a=list(map(int,input().split()))
k-=1
for i in range(n):
    if a[i]==1:
        l=i+1
        break
n-=k+1
if n%k==0:
    print(n//k+1)
else:
    print(n//k+2)       

Measured memory_bytes: 54080
from collections import Counter

x=int(input())
n=str(input())


#print(countN)
#abc
aaa=set([])
result=0
for i in range(x-2):
    a=n[i]
    if a not in aaa:
        aaa.add(a)
        bbb=set([])
        for j in range(i+1,x-1):
            b=n[j]
            if b not in bbb:
                bbb.add(b)
                ccc=set([])
                for k in range(j+1,x):
                    c=n[k]
                    if c not in ccc:
                        ccc.add(c)
                        result+=1
                    if len(ccc)==10:
                      break
                
                if len(bbb)==10:
                  break
    if len(aaa)==10:
        break
print(result)



        

        
        




Measured memory_bytes: 41836
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)

int main(){
  vector<vector<int>> c(3, vector<int>(3, 0));
  rep(i, 3){
    rep(j, 3){
      cin >> c.at(i).at(j);
    }
  }
  rep(a0, 101){
    rep(a1, 101){
      rep(a2, 101){
        if(c.at(0).at(0) - a0 == c.at(1).at(0) - a1 &&
           c.at(1).at(0) - a1 == c.at(2).at(0) - a2 &&
           c.at(0).at(1) - a0 == c.at(1).at(1) - a1 &&
           c.at(1).at(1) - a1 == c.at(2).at(1) - a2 &&
           c.at(0).at(2) - a0 == c.at(1).at(2) - a1 &&
           c.at(1).at(2) - a1 == c.at(2).at(2) - a2){
          cout << "Yes" << endl;
          return 0;
        }
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).ok();
  buf
    .trim()
    .split_whitespace()
    .map(|x| x.parse().ok().unwrap())
    .collect()
}

fn main() {
  let v: Vec<usize> = read_vec();
  let (n, m) = (v[0], v[1]);
  let lights: Vec<Vec<usize>> = (0..m).map(|_| read_vec()).collect();
  let ps: Vec<usize> = read_vec();

  let mut ans = 0;
  for i in 0..(2_u32.pow(n as u32)) as usize {
    let bits: Vec<char> = format!("{:010b}", i).chars().rev().collect();
    let mut all = true;
    for (j, light) in lights.iter().enumerate() {
      let cnt = &light[1..].iter().filter(|&s| bits[s - 1] == '1').count();
      if cnt % 2 != ps[j] {
        all = false;
        break;
      }
    }
    if all {
      ans += 1;
    }
  }
  println!("{}", ans);
}


Measured memory_bytes: 4352
#include <stdio.h>
bool mp[105][105];
int main(){
 int a,b;
 scanf("%d%d",&a,&b);
 a--;
 b--;
 for (int i = 0;i < 50;i++)
{
 for (int j = 0;j < 100;j++)
{
 mp[i][j]= 1;
}
}
 int x = 0,y = 0;
 while (a)
{
 mp[x][y]= 0;

 a--;
 y += 2;
 if (y >= 100)
{
 x += 2;
 y = 0;
}
}
 x = 99,y = 0;
 while (b)
{
 mp[x][y]= 1;
 y += 2;
 b--;
 if (y >= 100)
{
 x -= 2;
 y = 0;
}
}
 printf("100 100\n");
 for (int i = 0;i < 100;i++)
{
 for (int j = 0;j < 100;j++)
{
 if (mp[i][j]) printf("#");
 else printf(".");
}
 puts("");
}
 return 0;
}

Measured memory_bytes: 1584
#include<cstdio>
#include<iostream>
using namespace std;
int n,k;
long long int ans=0;
int main(){
	ios::sync_with_stdio(false);
	cin>>n>>k;
	for(int i=k+1;i<=n;++i){
		int shang=n/i,yushu=n%i;
		ans+=((i-k)*shang+max(0,yushu+1-k));
		}
	if(k==0) ans-=n;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
		using namespace std;
		
		typedef long long ll;
		#define pi 3.14159265 
		#define EPS 1e-8
		
		#define mod 1000000007
		#define fi first
		#define se second
		#define mp make_pair
		#define pb push_back
		#define endl "\n"

		const ll INF=(ll)2e18;
		
		long long binpow(long long a, long long b, long long m) {
		a %= m;
		long long res = 1;
		while (b > 0) {
			if (b & 1)
				res = res * a % m;
			a = a * a % m;
			b >>= 1;
		}
		return res;
		}
		
		
		int main()
		{
			 ios_base::sync_with_stdio(false);
			 cin.tie(NULL);
			
			ll n,m;
			cin>>n>>m;
			vector<ll> v(n);
			ll s=0;
			for(ll i=0;i<n;i++)
			{
				cin>>v[i];s+=v[i];
			}
			sort(v.begin(),v.end(),greater<int>());
			
			if(v[m-1]>=((s*1.0)/(4*m)))
			{
				cout<<"Yes";
			}
			else
				cout<<"No";
		}


Measured memory_bytes: 256
As = [list(map(int, input().split())) for x in range(3)]
N = int(input())
bs = [int(input()) for x in range(N)]


def create_bingo_card():
  result = [[0, 0, 0] for x in range(3)]
  i = 0
  while True:
    i2 = 0
    while True:
      if bs[i2] in As[i]:
        result[i][As[i].index(bs[i2])] += 1
      i2 += 1
      if i2 == len(bs):
        break
    i += 1
    if i == len(As):
      break
  return result


def solvd(bingo):
  tmp = [bingo[0][0], bingo[1][1], bingo[2][2]]
  if check1(tmp):
    print("Yes")
    return

  tmp = [bingo[0][2], bingo[1][1], bingo[2][0]]
  if check1(tmp):
    print("Yes")
    return

  r = 0
  for x in range(3):
    tmp = [bingo[0][x], bingo[1][x], bingo[2][x]]
    if check1(tmp):
      print("Yes")
      return

    bingoSet = set(bingo[x])
    if check2(bingoSet):
      r += 1

  if r >= 1:
    print("Yes")
    return
  print("No")


def check1(s):
  return s.count(1) == 3


def check2(s):
  return not (0 in list(s))


def main():
  Cs = create_bingo_card()
  solvd(Cs)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define N 200

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


long double val;

int main(){
	int n;
	int t;
	scanf("%d", &n);
	for(int i=0;i<n;i++){
		scanf("%d", &t);
		val+=1.0/t;
	}
	printf("%.12lf\n", ((double)(1/val)));
	return 0;
}

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

using namespace std;

int N, T;

//1-idx
int dp1[3000 + 10][3000 + 10];//dp1[i][j] := [1, i]品目まで食べるかを選んで、jの時間がかかったときのおいしさの最大値 
int dp2[3000 + 10][3000 + 10];//dp2[i][j] := [i, N]品目まで食べるかを選んで、jの時間がかかったときのおいしさの最大値
vector<int> A, B;

int main() {
	cin >> N >> T;
	for (int i = 0; i < N; i++) {
		int a, b;
		cin >> a >> b;
		A.push_back(a), B.push_back(b);
	}
	
	dp1[0][0] = 0;
	for (int i = 1; i <= N; i++) {
		for (int j = 0; j <= T - 1; j++) {
			dp1[i][j] = dp1[i - 1][j];
			if (j - A[i - 1] >= 0)dp1[i][j] = max(dp1[i][j], dp1[i - 1][j - A[i - 1]] + B[i - 1]);
		}
	}

	dp2[N + 1][0] = 0;
	for (int i = N; i >= 1; i--) {
		for (int j = 0; j <= T - 1; j++) {
			dp2[i][j] = dp2[i + 1][j];
			if (j - A[i - 1] >= 0)dp2[i][j] = max(dp2[i][j], dp2[i + 1][j - A[i - 1]] + B[i - 1]);
		}
	}

	int ans = max(dp1[N][T - 1], dp2[1][T - 1]);
	for (int i = 0; i <= N - 1; i++) {
		for (int j = 0; j <= T - 1; j++) {
			ans = max(ans, dp1[i][j] + B[i] + dp2[i + 2][T - 1 - j]);
		}
	}
	cout << ans << endl;
	
	return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<vector<int>> A(2,vector<int>(N));
    for(int i = 0;i < 2;i++){
        for(int j = 0;j < N;j++){
            cin >> A[i][j];
        }
    }
    vector<vector<int>> S(2,vector<int>(N+1,0));
    for(int j = 0;j < N;j++){
        S[0][j+1] = S[0][j] + A[0][j];
        S[1][j+1] = S[1][j] + A[1][j];
    }
    int ans = 0;
    for(int j = 0;j < N;j++){
        ans = max(ans,S[0][j+1] + S[1][N] - S[1][j]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N,K = map(int,input().split())
A = list(map(int,input().split()))
L = 60
dp = [[-1]*N for _ in range(L+1)]
for i,a in enumerate(A):
    dp[0][i] = a-1
for i in range(L):
    for j in range(N):
        dp[i+1][j] = dp[i][dp[i][j]]
ans = 0
for i in range(L):
    if K&(1<<i):
        ans = dp[i][ans]
print(ans+1)

Measured memory_bytes: 175044
S = list(input())
ops = []
lst = []

for i in range(8):
    ops.append(bin(i))
    ops[i] = ops[i][2:].zfill(3)

for i in range(8):
    res = S[0]
    for j in range(3):
        if ops[i][j] == "0":
            res = res + "+" + S[j+1]
        else:
            res = res + "-" + S[j+1]
    if eval(res) == 7:
        res = res + "=7"
        lst.append(res)
        break

print(lst[0])

Measured memory_bytes: 3064
import java.io.*;
class Main
{
public static void main(String args[])throws IOException
{
BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
while(true)
{

int fee=Integer.parseInt(input.readLine());
if(fee==0)break;
int sum=0;
for(int i=0;i<9;i++)
{
sum+=Integer.parseInt(input.readLine());
}
System.out.println(fee-sum);
}
}
}

Measured memory_bytes: 16852
#B
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

cnt = 0
for i in range(n):
    cnt += b[a[i]-1]
    if i < n-1:
        if a[i] + 1 == a[i+1]:
            cnt += c[a[i] - 1]
            
print(cnt)


Measured memory_bytes: 3060
N = int(input())
value = [[0]*3 for _ in range(N+1)]
for i in range(N):
  a = list(map(int, input().split()))
  for k in range(3):
    value[i+1][k] = a[k]

dp = [[0]*3 for _ in range(N+1)]
for i in range(1,N+1):
  for j in range(3):
    for k in range(3):
      if j == k:
        continue
      dp[i][k] = max(dp[i][k], dp[i-1][j] + value[i][k])
ans = 0
for k in range(3):
  ans = max(ans, dp[N][k])
  
print(ans)

Measured memory_bytes: 70252
#include <bits/stdc++.h>
using namespace std;
#define Int int64_t
#define dump(x) cout << (x) << endl
#define fi first
#define se second
Int mod = 1e9+7;
//Int mod = 998244353;
Int INF = 1e18;
double EPS = 0.00000001;

int main() {
    Int n, k, q;
    cin >> n >> k >> q;
    vector<Int> a(n + 1, k);
 //   vector<Int> b(n + 1, 0);
    for (Int i = 1; i <= n; i++) {
        a[i] -= q;
    }
    for (Int i = 0; i < q; i++) {
        Int x;
        cin >> x;
        a[x]++;
    }
    for (Int i = 1; i <= n; i++) {
        dump(a[i] <= 0 ? "No" : "Yes");
    }
    return 0;
}

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

int main(){
    int H, W; cin >> H >> W;
    bool map_info[H][W];
    queue<pair<int,int>> pos;
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            char c; cin >> c;
            if(c=='.'){
                map_info[i][j] = false;
            } else {
                map_info[i][j] = true;
                pos.push(make_pair(i, j));
            }
        }
    }

    int paint_cnt = 0;
    int dx[4] = {-1, 1, 0, 0};
    int dy[4] = { 0, 0,-1, 1};

    while(!pos.empty()){
        queue<pair<int,int>> storage;
        bool painted = false;
        while(!pos.empty()){
            pair<int, int> from = pos.front();
            pos.pop();
            for(int i=0; i<4; i++){
                int y = from.first +dy[i];
                int x = from.second+dx[i];
                if(y<0 || y>=H || x<0 || x>=W) continue;
                if(map_info[y][x] == false){
                    map_info[y][x] = true;
                    painted = true;
                    storage.push(make_pair(y, x));
                }
            }
        }
        if(painted==true) paint_cnt++;
        pos = storage;
    }

    cout << paint_cnt << endl;
}


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

int main(){
    string s, t;
    cin >> s >> t;

    int n = s.size();
    int m = 26;
    vector<int> list_s(26, -1);
    vector<int> list_t(26, -1);
    for(int i = 0; i < n; i++){
        int a = s[i] - 'a';
        int b = t[i] - 'a';

        if(list_s[a] != -1 || list_t[b] != -1){
            if(list_s[a] != b || list_t[b] != a){
                cout << "No" << endl;
                return 0;
            }
        }else{
            list_s[a] = b;
            list_t[b] = a;
        }
    }

    cout << "Yes" << endl;
   
    return 0;

}


Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d,maxv,maxc;
	cin>>a>>b>>c>>d;
	maxv=max(a,max(b,c));
	if(maxv==a)maxc=1;
	if(maxv==b)maxc=2;	
	if(maxv==c)maxc=3;
	for(int i=1;i<=d;i++)maxv*=2;
	if(maxc==1)cout<<maxv+b+c;
	if(maxc==2)cout<<maxv+a+c;
	if(maxc==3)cout<<maxv+a+b;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
S = input()
st = set()
nums = [str(i) for i in range(10)]
for i in range(10):
    for j in range(10):
        for k in range(10):
            flag1 = False
            flag2 = False
            for l in range(N):
                if not flag1 and S[l] == nums[i]:
                    flag1 = True
                elif flag1 and not flag2 and S[l] == nums[j]:
                    flag2 = True
                elif flag1 and flag2 and S[l] == nums[k]:
                    st.add(nums[i] + nums[j] + nums[k])
                
print(len(st))
                


Measured memory_bytes: 45148
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  ll n;
  cin >> n;
  vl a(n);
  rep(i,n){
    cin >> a[i];
  }
  ll cnt4=0,cnt2=0;
  rep(i,n){
    if(a[i]%4==0){
      cnt4++;
    }
    else if(a[i]%2==0){
      cnt2++;
    }
  }
  if(cnt2<=1){
    if(2*cnt4+1>=n){
      cout << "Yes" << endl;
    }
    else
      cout << "No" << endl;
  }
  else{
    if(2*cnt4+cnt2>=n){
      cout << "Yes" << endl;
    }
    else
      cout << "No" << endl;
  }
}

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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,s) for (auto i = begin(s); i != end(s); ++i)
#define itrepd(i,s) for (auto i = --end(s); i != begin(s); --i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
#define rall(f,x,...) [&](decltype(x)& whole) { return (f)(rbegin(whole), rend(whole), ##__VA_ARGS__); }(x)
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr T mins(T& a, Args... args) { return a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr T maxs(T& a, Args... args) { return a = max<T>({ a,args... }); }

string s;
void solve() {
    cin >> s;

    int n = sz(s);
    int ans = 0;
    rep(i, n) if (s[i] != s[n - i - 1]) ++ans;

    cout << ans / 2 << endn;

}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout << flush;
    return 0;
}


Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
      Scanner sc=new Scanner(System.in);
      String cur=sc.nextLine();
      String a=cur.split(" ")[0];
      String b=cur.split(" ")[1];
      BigDecimal c=new BigDecimal(a);
      BigDecimal d=new BigDecimal(b);
      BigDecimal res=c.multiply(d);
      long l=res.setScale( 0, BigDecimal.ROUND_FLOOR ).longValue();
      System.out.println(l);
    }
}

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

int main() {
  int a;
  cin >> a;
  cout << a+a*a+a*a*a << endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    for (int i = 1; i <= 9; i++)
    {
        if (n % i == 0)
        {
            int tmp = n / i;
            if (1 <= i && i <= 9 && 1 <= tmp && tmp <= 9)
            {
                cout << "Yes" << endl;
                return 0;
            }
            // cout << tmp << endl;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll a;
    string S,T;
    cin >> S >> T;
    ll N = S.size();
    ll ans = 0;
    rep(i,N){
        if(S[i] != T[i])ans++;
    }
    cout << ans << endl;
}


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

typedef long long ll;
typedef unsigned long long ull;

int main() {
  ll n;
  cin >> n;

  vector<ll> a(n+1, 0);
  for (ll i = 1; i <= n; ++i) {
    cin >> a[i];
  }

  vector<ll> b(n+1, 0);
  vector<ll> ans;
  for (ll i = n; i > 0; --i) {
    if (b[i] % 2 == a[i]) continue;

    ans.push_back(i);

    ll x = 1;
    while (x <= sqrt(i)) {
      if (i % x == 0) {
        b[x]++;
        if (x != i/x) b[i/x]++;
      }
      x++;
    }
  }

  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (ll i = 0; i < ans.size(); ++i) {
    cout << ans[i] << " ";
    if (i == ans.size()-1) cout << endl;
  }
  
  return 0;
}

Measured memory_bytes: 4980
#include <iostream>
#include <climits>

using namespace std;

int main(){
    int N,T;
    cin >> N >> T;
    int A[N];
    for(int i=0;i<N;i++) scanf("%d", &A[i]);

    int minA[N],profit[N];
    int min_value=INT_MAX;
    int max_value=0;
    int suffer=0;
    for(int i=0;i<N;i++){
        if(A[i]<min_value) min_value=A[i];
        minA[i]=min_value;
        profit[i]=A[i]-minA[i];
        if(max_value==profit[i]){
            suffer++;
        }else if(max_value<profit[i]){
            max_value=profit[i];
            suffer=1;
        }
    }
    cout << suffer << endl;
    return 0;
}

Measured memory_bytes: 1408
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
      long h = sc.nextLong();
      int n = sc.nextInt();
      int arr[] = new int[n];
      long sum=0;
      for(int i=0;i<n;i++){
        arr[i] = sc.nextInt();
        sum += arr[i];
      }
      if(sum >= h)
        System.out.println("Yes");
      else
        System.out.println("No");
  }
}


Measured memory_bytes: 51880
#include <bits/stdc++.h>
using ll = long long;
int main()
{
    int N;
    std::cin >> N;
    int ans = 0;
    auto rep = [&](auto&& self, ll n, bool tw, bool th, bool fi) -> void {
        if (0 < n and n <= N and tw and th and fi) { ans++; }
        if (n > N) { return; }
        self(self, 10 * n + 7, true, th, fi);
        self(self, 10 * n + 5, tw, true, fi);
        self(self, 10 * n + 3, tw, th, true);
    };
    rep(rep, 0, false, false, false);
    std::cout << ans << std::endl;
    return 0;
}


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

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define mp make_pair
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define MOD 1000000007

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



Measured memory_bytes: 3088
#include<stdio.h>
#include <string.h>
 
int main(void){
  char s[15];
  scanf("%s", s);
  int req = 15-strlen(s);
  int win = 8-req;
  int i;
  int maru = 0;
  for(i=0;i<15;i++){
    if(s[i]=='o'){
      maru++;
    }
  }
  if(win<=maru){
    printf("YES");
  }else{
     printf("NO");
  }
  return 0;
}

Measured memory_bytes: 256
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int x;
	cin>>x;
	ll r = x/500;
	ll r1 = x%500;
	ll cost = r*1000;
	ll r2 = r1/5;
	cost += r2*5;

	cout<<cost;
	return 0;
}

Measured memory_bytes: 256
#define _'Kb'
M=1e9+7;A[_];F[_];long P[_],I[_],x,t='.-';i,j,k=_-1;
f(a,b){return F[a+b]*I[a]%M*I[b]%M;}
main(s){
	for(;++x<_;~scanf("%d",A+i)&&i++%2&&gets(P))s=F[x]=x*s%M,t=I[k]=k--*t%M;
	for(qsort(A,i/2,8,"H\x8b\7H+\6t\5H\x99\x92\f \xc3");*I=j<i;P[j++-1]=x)
	for(x=f(t=--A[++j],s=--A[k=j]);k;x=s<A[k-=2]?x:(x-f(s-A[k],t-A[k+1])*P[k]%M+M)%M);
	printf("%d",x);
}////////////////////

Measured memory_bytes: 7432
#include<stdio.h>

int main(void)
{
  char pre[3],Tenki[3];
  scanf("%c%c%c\n%c%c%c",&pre[1],&pre[2],&pre[3],&Tenki[1],&Tenki[2],&Tenki[3]);
  int i,j;
  j=0;
  for(i=1;i<=3;i++){
    if(pre[i]==Tenki[i]){
      j++;
    }
  }
  printf("%d",j);
  
  return 0;
}

Measured memory_bytes: 128
use strict;
use warnings;

my %road;
my ($town, $n, $m);

while(<>){
	chomp;
	if($. == 1){
		$town = $1 if(/^(\d+) /);
	}
	else{
		($n, $m) = split(/ /);
		$road{$n}++;
		$road{$m}++;
	}
}

for my $i (1 .. $town){
	$road{$i} = 0 unless (defined $road{$i});
	print $road{$i} . "\n";
}


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

int main() {
  int k, n;
  cin >> k >> n;
  vector<int> pos(n);
  for (int i = 0; i < n; i++) cin >> pos[i];
  int max_d = -1;
  for (int i = 0; i < n; i++) {
    int d = (pos[(i+1)%n]- pos[i] + k) % k;
    //cout << d << endl;
    max_d = max(max_d, d);
  }

  cout << k - max_d << endl;
}


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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,s) for (auto i = begin(s); i != end(s); ++i)
#define itrepd(i,s) for (auto i = --end(s); i != begin(s); --i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
#define rall(f,x,...) [&](decltype(x)& whole) { return (f)(rbegin(whole), rend(whole), ##__VA_ARGS__); }(x)
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr T mins(T& a, Args... args) { return a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr T maxs(T& a, Args... args) { return a = max<T>({ a,args... }); }

int a, b, c;
void solve() {
    cin >> a >> b >> c;

    if (a + b + c >= 22) cout << "bust" << endn;
    else cout << "win" << endn;

}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout << flush;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int mod = (int)1e9 + 7, INF = (int)1e9;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };


int main(void) {
    int n;
    string ans;

    scanf("%d", &n);

    if (n % 10 == 3) {
        ans = "bon";
    }
    else if ((n % 10) * (n % 10 - 1) * (n % 10 - 6) * (n % 10 - 8) == 0) {
        ans = "pon";
    }
    else {
        ans = "hon";
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 3676
S0="zyxwvutsrqponmlkjihgfedcba"
S=input()
N=len(S)
if S==S0:
    print(-1)
elif len(S) == 26:
    for i in reversed(range(N-1)):
        if S[i]<S[i+1]:
            for j in reversed(range(i+1,N)):
                if S[j]>S[i]:
                    print(S[:i]+S[j])
                    exit()
else:
    for c in sorted(S0):
        if c not in S:
            print(S+c)
            exit()
#['a', 'ab', 'abc', 'ac', 'acb', 'b', 'ba', 'bac', 'bc', 'bca', 'c', 'ca', 'cab', 'cb', 'cba']


Measured memory_bytes: 38256
n,a,b,c,d=map(int,input().split())
s=input()
a-=1
b-=1
c-=1
d-=1
for i in range(a,max(c,d)):
    if s[i]==s[i+1]=="#":
        print("No")
        exit()
if a<b and c<d:
    print("Yes")
    exit()
ans=0
for i in range(b-1,d+2):
    if s[i]==".":
        ans+=1
    else:
        if ans>=3:
            print("Yes")
            exit()
        ans=0
if ans>=3:
    print("Yes")
    exit()
print("No")

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	for(int i=0;i<s.size()-1;i++){
		if(s[i]!=s[i+1]){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  const char ca = a + '0';
  const char cb = b + '0';
  if (a == b) {
    for (int i = 0; i < a; ++i) cout << cb;
    cout << '\n';
  } else if (a < b) {
    for (int i = 0; i < b; ++i) cout << ca;
    cout << '\n';
  } else {
    for (int i = 0; i < a; ++i) cout << cb;
    cout << '\n';
  }
  return 0;
}


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

int A, B, C, D, E, K;
vector<int> a;

int main() {
    cin >> A >> B >> C >> D >> E >> K;
    a.push_back(A); a.push_back(B); a.push_back(C); a.push_back(D); a.push_back(E);
    bool istrue = true;
    for (int i=0; i<a.size(); i++) {
        for (int j=i+1; j<a.size(); j++) {
            if (abs(a[i] - a[j]) > K) { istrue = false; break; }
        }
    }
    istrue ? cout << "Yay!\n" : cout << ":(\n";
    return 0;
}


Measured memory_bytes: 3568
#include <stdio.h>
int main()
{ 
    char s1,s2,s3;
	int n;
	scanf("%c%c%c",&s1,&s2,&s3);
	s1=s1-'0';
	s2=s2-'0';
	s3=s3-'0';
	n=s1+s2+s3;
	printf("%d\n",n);
	return 0;	
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long   ll;
typedef unsigned long long   ull;
typedef long double ld;
typedef pair<ll, ll>    pll;
typedef pair<ull, ull>    pull;
typedef pair<ll, ll>  pii;
typedef pair<ld, ld>  pld;
ll n;
ll mod = 1e9+7;
ll dp[3009][3009];
char a[3009];

void upd(ll lev, ll l, ll r, ll val){
    if(l > r)
        return;
    
    dp[lev][l] += val;
    dp[lev][l] %= mod;
    if(dp[lev][l] < 0)
        dp[lev][l] += mod;
    
    dp[lev][r+1] += -val;
    dp[lev][r+1] %= mod;
    if(dp[lev][r+1] < 0)
        dp[lev][r+1] += mod;
}
int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);

    cin >> n;
    for(ll i = 0; i < n; ++i)
        cin >> a[i];
    upd(0, 0, n-1, 1);
    for(ll i = 0; i < n-1; ++i){
        for(ll j = 0; j < n; ++j){
            if(j > 0)
                dp[i][j] = (dp[i][j-1] + dp[i][j])%mod;
            if(a[i] == '<')
                upd(i+1, j , n-2-i, dp[i][j]);
            else if(a[i] == '>')
                upd(i+1, 0 , j-1, dp[i][j]);
        }
    }
    cout << dp[n-1][0] << "\n";
}

Measured memory_bytes: 70784
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static final int MOD = 1000000007;
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		long x = parseLong(sc.next());
		sc.close();
		long yen=100;
		int cnt=0;
		while(x>yen) {
			yen+=(long)floor((double)yen*.01);
			cnt++;
		}
		out.println(cnt);
	}
}


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

typedef long long int ll;

int main()
{
    ll n, k;
    cin >> n >> k;
    vector<ll> d(k), a(n);
    for(ll i = 0;i < k;i++){
        cin >> d[i];
        for(ll j = 0;j < d[i];j++){
            ll t;
            cin >> t;
            a[t - 1]++;
        }
    }

    ll ans = 0;
    for(ll i = 0;i < n;i++){
        if(a[i] == 0){
            ans++;
        }
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>

int main(void){
    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

    if(x >= r && x <= W-r){
        if(y >= r && y <= H-r){
            printf("Yes\n");
        }else{
            printf("No\n");
        }
    }else{
        printf("No\n");
    }
    
    return 0;
}


Measured memory_bytes: 2056
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := NewScanner()
	S := sc.Next()

	if S == "ABC" {
		fmt.Println("ARC")
	} else {
		fmt.Println("ABC")
	}

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 1752
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();
            int c = sc.nextInt();
            // 文字列の入力
            int sum=a+b;

            if(a<=c){
                if(sum>=c){
                    System.out.println("YES");
                }else{
                    System.out.println("NO");
                }
            }else{
                System.out.println("NO");
            }
        }
    }

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  int sum = accumulate(A.begin(), A.end(), 0);
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    if ((long double) A.at(i) < (long double) sum / (4 * M)) continue;
    cnt++;
  }
  cout << ((cnt >= M) ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 3604
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
    read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
    match n {
        0 => a,
        _ => {
            a.push(read::<T>());
            read_n_logic(n - 1, a)
        }
    }
}
use std::cmp::{max, min};

fn main() {
    let k: usize = read();
    let a: usize = read();
    let b: usize = read();
    let mut ans = "NG";
    for i in a..b + 1 {
        if i % k == 0 {
            ans = "OK";
            break;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2104
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 22;
char dn[dm], * di = dn;
char C[10];
int keta = 0;
inline void putint(int X) {
	keta = 0;
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}
inline void putmae() {
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

int dp2[1 << 18];
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int N = getint();
	int n = 1 << N;
	int dp1[1 << 18];
	rep(i, n) dp1[i] = getint();

	rep(k, N) {
		int m = 1 << k;
		int m2 = ~(1 << k);
		for (int j = n - 1 & m2; j >= 0; j = j - 1 & m2) {
			int i = j | m;

			if (dp1[i] >= dp1[j]) {
				dp2[i] = max(dp2[i], dp1[j]);
			}
			else {
				dp2[i] = max(dp1[i], dp2[j]);
				dp1[i] = dp1[j];
			}
		}
	}

	int saidai = 0;
	rep1(i, n - 1) {
		if (saidai < dp1[i] + dp2[i]) {
			saidai = dp1[i] + dp2[i];
			putint(saidai);
		}
		else putmae();
	}
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 8192