akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstring>
using namespace std;

int t[25][6];

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	int s=0;
	bool flag;
	while(cin>>n){
		if(!n)break;
		memset(t,0,sizeof(t));
		for(i=n-1;i>=0;i--){
			for(j=0;j<5;j++)cin>>t[i][j];
		}
		flag=true,s=0;
		while(flag){
			flag=false;
			for(i=0;i<n;i++){
				for(j=0,k=1;j<4;j++){
					if(t[i][j]==t[i][j+1])k++;
					else{
						if(k>=3 && t[i][j]!=0){
							s+=t[i][j]*k;
							for(;k>0;k--)t[i][j-k+1]=0;
							flag=true;
						}
						k=1;
					}
				}
				if(k>=3 && t[i][j]!=0){
					s+=t[i][j]*k;
					for(;k>0;k--)t[i][j-k+1]=0;
					flag=true;
				}
			}
			for(i=0;i<5;i++){
				for(j=0,k=0;j<n;j++){
					if(t[j][i]==0)continue;
					t[k][i]=t[j][i],k++;
				}
				for(;k<n;k++)t[k][i]=0;
			}
		}
		cout<<s<<endl;
	}
}
			



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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

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

typedef long long ll;

void solve(long long N, std::vector<long long> A, std::vector<long long> B) {
  ll tot = 0;
  rep(i, N) {
    ll machi1 = min(B[i], A[i]);
    B[i] -= machi1;
    tot += machi1;
    if (B[i] > 0) {
      ll machi2 = min(B[i], A[i + 1]);
      A[i + 1] -= machi2;
      tot += machi2;
    }
  }
  cout << tot << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N + 1);
  for (int i = 0; i < N + 1; i++) {
    scanf("%lld", &A[i]);
  }
  std::vector<long long> B(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &B[i]);
  }
  solve(N, std::move(A), std::move(B));
  return 0;
}


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

int main(){
	int N,M;
	cin >> N>>M;
	vector<int> a(M);
	vector<int> b(M);
	vector<int> City(N,0);
	for (int i = 0; i < M; i++) {
		cin>>a.at(i)>>b.at(i);
	}
	for (int i = 0; i < M; i++) {
		City.at(a.at(i)-1)+=1;
		City.at(b.at(i)-1)+=1;
	}
	for(int i=0;i<N;i++){
		cout << City.at(i) << endl;
	}
}

Measured memory_bytes: 256
import java.util.*;

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

        if(k == 1){
            System.out.println((long)n*(long)n*(long)n);
        }else if(k % 2 == 0){
            long tmp1 = n/k;
            long tmp2 = n/k;
            if(n % k >= k/2) tmp2++;
            System.out.println(tmp1*tmp1*tmp1 + tmp2*tmp2*tmp2);
        }else{
            long tmp = n/k;
            System.out.println(tmp*tmp*tmp);
        }
    }
}

Measured memory_bytes: 23892
# coding: utf-8
import sys

stdin = sys.stdin
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))


def main():
    ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
    mod = 26
    n = ni()
    ans = ''
    while n > mod:
        ans += ascii_lowercase[(n%mod)-1]
        if n%mod == 0:
            n = int(n/mod)-1
        else:
            n = int(n/mod)
    ans += ascii_lowercase[(n%mod)-1]
    print(ans[::-1])
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 61904
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int w,h;
	cin>>w>>h;
	int a=1;
	int b=1;
	int ans=0;
	int n;
	cin>>n;
	rep(i,n){
		int t;
		cin>>t;
		if(t==0) a++;
		else b++;
		if(b==w-1){
			if(a==w-1||a==w+1){
				ans++;
			}
		}
		else if(b<w-1){
			if(a==b){
				ans++;
			}
		}
		else if(b==w+h-4){
			if(a==w+h-2||a==w+h){
				ans++;
			}
		}
		else if(b<w+h-4){
			if(b+2==a){
				ans++;
			}
		}
		else{
			if(b+4==a){
				ans++;
			}
		}
	}
	cout<<ans<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

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

using namespace std;

#define ll  long long
#define ld  double

#define sz(x)   (int)x.size()
#define all(x)  x.begin(),x.end()

#define pb  emplace_back
#define X   first
#define Y   second

const int   N   = 2e5 + 5;

typedef pair<int,int>   ii;

int a[N];
int d[N];

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

    int n;  cin >> n;   a[n] = n;
    set<int> S;
    set<ii>  G;

    for(int i = 0 ; i < n ; ++i)    {
        int x;  cin >> x;   --x;
        a[i] = x;
        d[x]++;
    }
    for(int i = 0 ; i < n ; ++i)
        S.insert(i),
        G.insert(ii(d[i],i));

    vector<int> res;

    int last = n;

    while (S.size())    {
        bool found = 0;
        if (S.size() == 3)   {
            vector<int> P;
            for(int x : S)
                P.pb(x);

            do  {
                if (P[0] == a[last])    continue;
                if (P[1] == a[P[0]])    continue;
                if (P[2] == a[P[1]])    continue;

                for(int x : P)
                    res.pb(x);

                found = 1;

                break;
            }   while (next_permutation(all(P)));

            if(!found)  {
                cout << "-1";
                return  0;
            }
            break;
        }

        for(int x : S)  if (x != a[last])   {
            G.erase (ii(d[x],x));

            if (G.empty() || (*--G.end()).X < sz(S) - 1)    {
                found = 1;
                res.pb(x);
                last = x;
                S.erase(x);
                break;
            }
            G.insert(ii(d[x],x));
        }
        if(!found)  {
            cout << -1;
            return  0;
        }
        int u = a[last];

        if (G.find(ii(d[u],u)) != G.end())  {
            G.erase (ii(d[u],u));   --d[u];
            G.insert(ii(d[u],u));
        }
    }
    for(int x : res)
        cout << x + 1 << " ";
}

Measured memory_bytes: 11008
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
query = [[] for _ in range(N)]
ab = []
for _ in range(N-1):
    a, b = mapint()
    query[a-1].append(b-1)
    query[b-1].append(a-1)
    ab.append((a-1, b-1))

def dfs_lis(start):
    checked = [0]*N
    dist = [0]*N
    def dfs(now):
        checked[now] = 1
        for nx in query[now]:
            if not checked[nx]:
                dist[nx] = dist[now]+1
                dfs(nx)
    dfs(start)
    return dist

fe = dfs_lis(0)
snu = dfs_lis(N-1)
cnt = 0
for f, s in zip(fe, snu):
    if f<=s:
        cnt += 1

if cnt>N//2:
    print('Fennec')
else:
    print('Snuke')

Measured memory_bytes: 229144
public class Main {

  private static void solve() {
    int n = ni();

    System.out.println((n - 1) / 2);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}



Measured memory_bytes: 22228
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in);) {
			String s = sc.next();
			System.out.print(s.charAt(0));
			System.out.print(s.length() - 2);
			System.out.print(s.charAt(s.length() - 1));
			System.out.println();
		}

	}
}


Measured memory_bytes: 22996
using System;
using System.Collections.Generic;
using System.Linq;

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        var x = new int[N];
        var y = new int[N];
        var h = new int[N];
        var non_zero_x = 0;
        var non_zero_y = 0;
        var non_zero_h = 0;
        for (int i = 0; i < N; i++)
        {
            x[i] = cin.nextInt();
            y[i] = cin.nextInt();
            h[i] = cin.nextInt();
            if (h[i] != 0)
            {
                non_zero_x = x[i];
                non_zero_y = y[i];
                non_zero_h = h[i];
            }
        }

        for (int cx = 0; cx <= 100; cx++)
        {
            for (int cy = 0; cy <= 100; cy++)
            {
                long H = non_zero_h + Math.Abs(cx - non_zero_x) + Math.Abs(cy - non_zero_y);
                bool flag = true;
                for (int i = 0; i < N; i++)
                {
                    long tmp = Math.Max(H - Math.Abs(x[i] - cx) - Math.Abs(y[i] - cy), 0);
                    if (tmp != h[i])
                    {
                        flag = false;
                    }
                }
                if (flag)
                {
                    Console.WriteLine("{0} {1} {2}", cx, cy, H);
                    return;
                }
            }
        }
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }


    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
#include<iostream>
#include<set>
#define ll long long
using namespace std;
int a[1000000]={0};
int main(){
    int t;
    cin>>t;
    for(int i=0;i<t;i++){
        cin >>a[i];
    }
    int falg=1;
    int ma = a[0];
    for(int i=1;i<t;i++){
        if(ma-1>a[i]){
            cout<<"No"<<endl;
            falg=0;
            break;
        }
        ma = max(a[i],ma);
    }
    if(falg)
        cout<<"Yes"<<endl;
     return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};

int n,m;
int d[200010],e[200010];
vector<P> G[100010];
int inf=1000000000;

void solve(){
    cin >> n >> m;
    rep(i,n){
        cin >> d[i];
    }
    rep(i,m){
        int a,b;cin >> a >> b;a--;b--;
        G[a].emplace_back(b,i);
        G[b].emplace_back(a,i);
    }
    vector<int> v={};rep(i,n) v.push_back(i);
    sort(v.begin(),v.end(),[](int a,int b){return d[a]<d[b];});
    vector<int> ans(n,-1);
    for(int s:v){
        bool flag=(ans[s]!=-1);
        for(P p:G[s]){
            int t=p.first,id=p.second;
            if(e[id]!=0) {
                flag=true;
                continue;
            }
            if(d[t]<=d[s] && !flag && ans[t]!=-1){
                e[id]=d[s];
                ans[s]=ans[t]^1;
                flag=true;
            }
            else if(d[t]==d[s] && !flag && ans[t]==-1){
                e[id]=d[s];
                ans[s]=0;
                ans[t]=1;
                flag=true;
            }
            else if(d[t]<=d[s] && ans[t]!=-1){
                e[id]=inf;
            }
        }
        if(!flag){
            cout << -1 << endl;
            return;
        } 
    }
    rep(i,n){
        if(ans[i]) cout << "B";
        else cout << "W";
    }
    cout << "" << endl;
    rep(i,m){
        cout << e[i] << endl;
    }
}

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

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

using namespace std;

int main(){
    int n;
    int kushi[200];
    cin >> n;
    int count = 0;
    for(int i=0; i < 2*n; i++){
        cin >> kushi[i];
    }
    sort(kushi,kushi+(2*n));
    for(int j = 0; j < 2*n; j += 2){
        count += kushi[j];
    }
    cout << count << endl;
    return 0;

}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

YES = "Possible"  # type: str
NO = "Impossible"  # type: str


def solve(A: int, B: int):
    if 3 <= A and A%3==0:
        return YES
    elif 3 <= B and B%3==0:
        return YES
    elif 3 <= A+B and (A+B)%3==0:
        return YES
    return NO


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    print(solve(A, B))

if __name__ == '__main__':
    main()


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

using namespace std;

#define rep(i, a, n) for(int i = a; i < (n); ++i)

int main(){
  int n, k, h, cnt = 0;
  cin >> n >> k;
  rep(i, 0, n) {
    cin >> h;
    if (h >= k) ++cnt;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
from collections import deque

s = deque(input())
q = int(input())
query = [input().split() for _ in range(q)]

reverse = False

for i in range(q):
    now = query[i]
    if now == ['1']:
        reverse = not reverse
    else:
        f = now[1]
        c = now[2]
        if f == '1':
            s.append(c) if reverse else s.appendleft(c)
        else:
            s.appendleft(c) if reverse else s.append(c)

if reverse:
    s.reverse()

print(''.join(s))


Measured memory_bytes: 44532
from collections import defaultdict
inf = input().split()
N = int(inf[0])
W = int(inf[1])
dic = defaultdict(int)

line = input().split()

for a in line:
    dic[int(a)] += 1

for w in range(W):
    inf = input().split()
    b = int(inf[0])
    c = int(inf[1])
    dic[c] += b
    
keys = list(dic.keys())

keys.sort(reverse=True)

count = 0
ans = 0
for k in keys:
    while dic[k]>0:
        if count == N:
            break
        ans += k
        dic[k] -= 1
        count += 1
    if count == N:
        break

print(ans)


Measured memory_bytes: 38564
import numpy as np

def main(n, k):
    res = int(np.log(n) / np.log(k)) + 1
    return res

if __name__ == "__main__":
    cin = input()
    n = int(cin.split(" ")[0])
    k = int(cin.split(" ")[1])
    cout = main(n, k)
    print(cout)

Measured memory_bytes: 12484
n = int(input())
board = [1] * (n+1)

def divisor_num(n, board):
    for i in range(2, n+1):
        j = 1
        while i*j <= n:
            board[i*j] += 1
            j += 1

divisor_num(n, board)
res = sum([i * board[i] for i in range(1, n+1)])
print(res)


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

#define ll long long

int main(void){
    string s;
    cin >> s;
    if(s[0]!='A'){
        cout << "WA"<<endl;
        return 0;
    }
    int cnt = count(s.begin()+2,s.end()-1,'C');
    if(cnt != 1){
        cout << "WA"<<endl;
        return 0;        
    }
    cnt=0;
    for(int i=0;i<s.length();i++){
        if(s[i]<= 'Z' and s[i]>='A'){
            cnt++;            
        }
    }
    // cout << cnt << endl;
    if(cnt != 2){
        cout << "WA"<<endl;
        return 0;
    }
    cout << "AC"<<endl;
    return 0;
}

Measured memory_bytes: 256
//##MohK
//13/2/2020.... 10,20
#include <bits/stdc++.h>
using namespace std ;
using ll = long long ;
using ld = long double;
int main(){
    string a,b;
    cin>>a>>b;
    if(a==b)cout<<"EQUAL"<<endl;
    else if(a.size()<b.size())cout<<"LESS"<<endl;
    else if(a.size()>b.size())cout<<"GREATER"<<endl;
    else if(a>b)cout<<"GREATER"<<endl;
    else cout<<"LESS"<<endl;

    return 0 ;
}





Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<numeric>

#define REP(i, a) for(int i=0;i<(int)a;++i)
#define INF 1145141919;
typedef long long ll;
typedef long double ld;
using namespace std;

void call(int n) {
    int i = 1;
    while (i++ < n) {
        int x = i;
        if (x % 3 == 0) {
            cout << " " << i;
            continue;
        }
        bool f = false;
        while (x > 0) {
            if (x % 10 == 3) {
                cout << " " << i;
                f = true;
                break;
            }
            x /= 10;
        }
        if (f)continue;
    }
    cout << endl;
}

void solver() {
    int n;
    cin >> n;
    call(n);
}

int main() {
    solver();
    return 0;
}

Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
#define DB long double 
int N;
int main(){
    cin >> N;
    int sh = N / 100;
    int to = N % 100;
    bool t1 = (1 <= sh && sh <= 12);
    bool t2 = (1 <= to && to <= 12);
    if(t1 && !t2) cout << "MMYY" << endl;
    if(!t1 && t2) cout << "YYMM" << endl;
    if(t1 && t2) cout << "AMBIGUOUS" << endl;
    if(!t1 && !t2) cout << "NA" << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using static kyoupuro.Input;
using static kyoupuro.MyMath;

namespace kyoupuro {

    class Point {
        public int X { get; set; }
        public int Y { get; set; }
        public int H { get; set; }
    }

    class MainClass {

        public static void Main() {
            var N = NextInt();
            var list = new List<Point>();
            for (int i = 0; i < N; i++) {
                list.Add(new Point() { X = NextInt(), Y = NextInt(), H = NextInt() });
            }
            list.Sort((a, b) => b.H - a.H);

            for (int cx = 0; cx <= 100; cx++) {
                for (int cy = 0; cy <= 100; cy++) {
                    var nowH = Math.Abs(list.First().X - cx) + Math.Abs(list.First().Y - cy) + list.First().H;
                    if(list.All(point => point.H == Math.Max(0, nowH - Math.Abs(point.Y - cy) - Math.Abs(point.X - cx)))) {
                        Console.WriteLine($"{cx} {cy} {nowH}");
                        return;
                    }
                }
            }
        }
    }

    class MyMath {
        public static long Gcd(long a, long b) {
            return b == 0 ? a : Gcd(b, a % b);
        }
    }

    class Input {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line() {
            return Console.ReadLine();
        }

        public static int NextInt() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return int.Parse(enumerator.Current);
        }

        public static long NextLong() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return long.Parse(enumerator.Current);
        }

        public static string[] StrArr() {
            return Line().Split(' ');
        }

        public static List<int> IntList() {
            return StrArr().Select(int.Parse).ToList();
        }

        public static List<long> LongList() {
            return StrArr().Select(long.Parse).ToList();
        }

        public static void Skip(int line = 1) {
            enumerator.Reset();
            for (int i = 0; i < line; i++) Console.ReadLine();
        }

        public static void Reset() {
            enumerator.Reset();
        }
    }
}

Measured memory_bytes: 13396
import java.util.Scanner;

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

        while(true)
        {
            int H = sc.nextInt();
            int W = sc.nextInt();
    
            if(H==0 && W==0) break;

            for(i=0; i<H; i++)
            {
                for(k=0; k<W; k++)
                {
                    if(i%2 == 0)
                    {
                        if(k%2==0) System.out.printf("#");
                        else if(k%2==1) System.out.printf(".");
                    }                
                    else if(i%2 == 1)
                    {
                        if(k%2==0) System.out.printf(".");
                        else if(k%2==1) System.out.printf("#");
                    }
                }
                System.out.print("\n");
            }

            System.out.printf("\n");
        }

        sc.close();
    }
}


Measured memory_bytes: 58524
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const int MX = 200005;
int h, w, n, x, y, e;
set<int> st[MX];
int main(){
  int a, b;
  scanf("%d%d%d", &h, &w, &n);
  rep(i,n){
    scanf("%d%d", &x, &y);
    x--; y--;
    st[x].insert(y);
  }
  st[h].insert(0);
  for(int i=1; i<=h; i++){
    if(st[i].upper_bound(e) != st[i].begin()) return 0*printf("%d\n",i);
    if(st[i].find(e+1) == st[i].end()) e++;
  }
}

Measured memory_bytes: 18944
#include <iostream>

using namespace std;

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

  bool flag = false;

  for (int cNum = 0; cNum <= 25; cNum++) {
    for (int dNum = 0; dNum <= 15; dNum++) {
      if (cNum * 4 + dNum * 7 == N) flag = true;
    }
  }

  if (flag) cout << "Yes\n"; 
  else cout << "No\n"; 
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
 
using namespace std;
 
int main(){
    int array[3];
    for(int i = 0; i < 3; i++) scanf("%d",&array[i]);
    for(int i = 2; i > 0; i--){
        for(int j = 0; j < i; j++){
            if(array[j] > array[j+1])swap(array[j],array[j+1]);
        }
    }
    printf("%d %d %d\n",array[0],array[1],array[2]);
}


Measured memory_bytes: 2760
import java.util.Scanner;
import java.util.Arrays;

public class Main {

	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int[] waseda = new int[10];
		int[] keio = new int[10];
		for(int i=0; i<10; i++) {
			waseda[i]=in.nextInt();
		}
		for(int k=0; k<10; k++) {
			keio[k]=in.nextInt();
		}
		Arrays.sort(waseda);
		int pointw = waseda[7]+waseda[8]+waseda[9];
		Arrays.sort(keio);
		int pointk = keio[7]+keio[8]+keio[9];
		
		System.out.println(pointw+" "+pointk);
		}
	}

Measured memory_bytes: 17180
#include <stdio.h>
int main(void){
    int a,b,x,y;
    scanf("%d%d",&a,&b);
    if(a>=b){
        x=a;
        a=a-1;
    }else{
        x=b;
        b=b-1;
    }   
        if(a>=b){
        y=a;
        a=a-1;
    }else{
        y=b;
        b=b-1;
    }   
    printf("%d",x+y);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <set>
using namespace std;

const int MAX_N = 2e5+10;
int a[MAX_N];
int N;

void solve()
{
	sort(a, a+N);
	int ans = 0;
	multiset<int> have;
	for(int i=0;i<N;++i) have.emplace(a[i]);
	while(!have.empty()){
		long long biggest = *have.rbegin();
		have.erase(have.find(biggest));
		long long sum = 1;
		while(sum <= biggest) sum <<= 1;
		auto it = have.find(sum-biggest);
		if(it != have.end()){
			ans++;
			have.erase(it);
		}
	}
	cout << ans << endl;
}

int main()
{
	cin >> N;
	for(int i=0;i<N;++i) cin >> a[i];
	solve();
	return 0;
}

Measured memory_bytes: 10368
import sys
from collections import deque, defaultdict, Counter
from itertools import accumulate, product, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt, gcd, inf
from copy import deepcopy
import numpy as np
import scipy as sp

INF = inf
MOD = 1000000007

n, m = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()]for j in range(m)]    # nは行数

tmp = [True for i in range(n + 1)]
res = 0

for i in range(m):
    a, b = A[i]
    if H[a - 1] <= H[b - 1]:
        tmp[a] = False
    if H[a - 1] >= H[b - 1]:
        tmp[b] = False
for i in range(1, n + 1):
    if tmp[i]:
        res += 1

print(res)


Measured memory_bytes: 53040
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<i64>();
    let (a, b, c, k) = (v[0], v[1], v[2], v[3]);
    if k % 2 == 1
         {
        println!("{}", b - a);
    } else {
        println!("{}", a - b);
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 2108
module Main where
import Control.Monad
import Control.Applicative
import Data.Maybe
import Data.List
import qualified Text.Printf
import qualified Data.ByteString.Char8 as BC
import qualified Data.ByteString as BC

------------------------------------------

solve :: [Int] -> Maybe String
solve (x:xs) = f (show x) x xs
  where
    f msg v [] = guard (v == 7) >> return (reverse ("7=" ++ msg))
    f msg v (x:xs) = f (show x ++ "+" ++ msg) (v+x) xs <|> f (show x ++ "-" ++ msg) (v-x) xs

main :: IO ()
main = do
  s <- (map read <$> map (:[]) <$> getLine) :: IO [Int]
  let Just msg = solve s
  putStrLn msg

------------------------------------------

{- Int input -}

parseInt :: BC.ByteString -> Int
parseInt = fst . fromJust . BC.readInt

parseInts :: BC.ByteString -> [Int]
parseInts = map parseInt <$> BC.words

readInt :: IO Int
readInt = parseInt <$> BC.getLine

readInts :: IO [Int]
readInts = parseInts <$> BC.getLine

{- Double Formatting -}

doubleFmt :: Double -> String
doubleFmt = Text.Printf.printf "%.12f"


Measured memory_bytes: 508
import java.util.*;
import java.io.*;
import java.text.*;
import java.lang.*;
import java.math.*;

public class Main {

	public static void main(String[] args)
	{
                       Scanner in = new Scanner(System.in);
			int n = in.nextInt();
		        List<Character> arr = new ArrayList<Character>();
			in.nextLine();
			String str = in.nextLine();
			for(int i = 0; i < str.length(); i++) {
				if(str.charAt(i) != ' ')
					arr.add(str.charAt(i));
			}

			if(arr.contains('P') && arr.contains('W') && arr.contains('G') && arr.contains('Y'))
				System.out.println("Four");
			else
				System.out.println("Three");
	}
    
}

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

using namespace std;

typedef long long LL;

int main()
{
   char a;
   cin >> a;
   
   if(a >= 'A' && a <= 'Z'){
    cout << 'A' << "\n";
   }
   else{
    cout << 'a' << "\n";
   }
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
int main()
{
    int N, M;
    cin >> N;
    vector<int> T(N);
    rep(i, N)
    {
        cin >> T[i];
    }
    cin >> M;
    vector<int> P(M), X(M);
    rep(i, M)
    {
        cin >> P[i] >> X[i];
    }
    int sum = 0;
    rep(i, M)
    {
        sum = 0;
        rep(j, N)
        {
            if (j + 1 == P[i])
            {
                sum += X[i];
            }
            else
            {
                sum += T[j];
            }
        }
        cout << sum << endl;
    }

    return 0;
}


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

int main(){
  int m,f,r;
  while(1){
    cin >> m >> f >> r;
    if(m==-1 && f==-1 && r==-1)
      break;

    if(m==-1 || f==-1){
      cout << 'F' << endl;
    }else if(m+f>=80){
      cout << 'A' << endl;
    }else if(m+f>=65){
      cout << 'B' << endl;
    }else if(m+f>=50){
      cout << 'C' << endl;
    }else if(m+f>=30 && r>=50){
      cout << 'C' << endl;
    }else if(m+f>=30 && r<50){
      cout << 'D' << endl;
    }else{
      cout << 'F' << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 3072
#include <bits/stdc++.h>
#ifdef _WIN32
#include "debug.hpp"
#endif
using namespace std;

#define rep(i, N)  for(int i = 0; i < (N); i++)
#define reps(i, N) for(int i = 1; i <= (N); i++)
#define repr(i, N) for(int i = (N) - 1; i >= 0; i--)
#define pub push_back

template<typename T> 
void chmax(T &a, T b){ a = max(a, b); };
template<typename T> 
void chmin(T &a, T b){ a = min(a, b); };

typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;
const ll LINF = 10000000000000000;
const int MOD = 1000000007;
const int dx[9] = { 0, 1,  0, -1, 1,  1, -1, -1, 0};
const int dy[9] = { 1, 0, -1,  0, 1, -1, -1,  1, 0};
//--------------------------------------//
int N;
string S;

void solve(){
	int l = 0, r = 0;
	int c = 0;
	rep(i, N){
		if(c == 0 and S[i] == ')'){
			l++;
		}
		else if(S[i] == '('){
			c++;
		}
		else{
			c--;
		}
	}
	c = 0;
	repr(i, N){
		if(c == 0 and S[i] == '('){
			r++;
		}
		else if(S[i] == ')'){
			c++;
		}
		else{
			c--;
		}
	}
	rep(i, l){
		cout << '(';
	}
	cout << S;
	rep(i, r){
		cout << ')';
	}
	cout << endl;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> N >> S;
		solve();
	return 0;
}


Measured memory_bytes: 256
// Problem : C - Bugged
// Contest : AtCoder Regular Contest 075
// URL : https://atcoder.jp/contests/arc075/tasks/arc075_a
// Memory Limit : 256.000000MB 
// Time Limit : 2000.000000milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor2)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n,sum=0;cin>>n;
    ll a[n];for(ll i=0;i<n;i++)cin>>a[i],sum+=a[i];
    if(sum%10)return cout<<sum , 0;
    sort(a,a+n);
    for(ll i=0;i<n;i++)if(a[i]%10)return cout<<sum-a[i] , 0;
    cout<<"0";
}



Measured memory_bytes: 256
from collections import Counter
import copy
from itertools import combinations


def A(x):
  return 'Yes' if x >= 30 else 'No'


def B(N, D, X, Y):
  ans = 0
  for i in range(N):
    Di = X[i]**2 + Y[i]**2
    if Di <= D**2:
      ans += 1
  return ans


def C(K):
  mods = [0] * 1000001
  mod = 7 % K
  if mod == 0:
    return 1
  num_iters = 1
  while mods[mod] == 0:
    mods[mod] = 1
    mod = (mod * 10 + 7) % K
    num_iters += 1
    if mod == 0:
      return num_iters
  return -1


def main():
  # N, D = map(int, input().split())
  # X = []
  # Y = []
  # for i in range(N):
  #   Xi, Yi = map(int, input().split())
  #   X.append(Xi)
  #   Y.append(Yi)
  # print(B(N, D, X, Y))
  K = int(input())
  print(C(K))


if __name__ == '__main__':
  main()


Measured memory_bytes: 17292
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

s = input()
n = inp()
L = ''
for i in range(len(s))[::n]:
    L += s[i]
print(L)

Measured memory_bytes: 38256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val s = sc.next()

    var count = 0
    val bc = listOf(0) + s.map {
        if (it == '#') count++
        count
    }

    val c = bc.last()
    val ret = bc.foldIndexed(Integer.MAX_VALUE) { index, acc, next ->
        val cur = bc[index] + ((n - index) - (c - bc[index]))
        Math.min(acc, cur)
    }

    println(ret)
}


Measured memory_bytes: 42960
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

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

    ll A, B, C, K;
    cin >> A >> B >> C >> K;
    ll ans = 0;
    if (K <= A) {
        ans = K;
    } else if (K <= A + B) {
        ans = A;
    } else {
        ans = A - (K-A-B);
    }

    cout << ans << endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define _size(X) (int)((X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

string s;
bool used[26];

bool judge(string str) {
    for (int i = 0; i+1 < str.size(); ++i) {
        if (str[i] != str[i+1]) return false;
    }
    return true;
}

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

  cin >> s;

  for (int i = 0; i < s.size(); ++i) {
      used[s[i]-'a'] = true;
  }

  int ans = INFINT;
  for (int i = 0; i < 26; ++i) {
      if (used[i]) {
          string tmp_s = s;
          int tmp = 0;
          while (!judge(tmp_s)) {
              for (int j = 0; j+1 < tmp_s.size(); ++j) {
                  if (tmp_s[j] == i+'a' || tmp_s[j+1] == i+'a') {
                      tmp_s[j] = i+'a';
                  }
              }
              tmp_s.resize(tmp_s.size()-1);
              ++tmp;
          }
          ans = min(ans, tmp);
      }
  }


  cout << ans << endl;

  return 0;
}


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

using namespace std;
typedef long long ll;

int main() {
    ll N;
    cin >> N;
    vector<vector<ll>> v(3,vector<ll>(N)),dp(N,vector<ll>(3));
    for(int i=0;i<N;i++){
        for(int j=0;j<3;j++){
            cin >> v[j][i];
        }
    }
    for(int i=0;i<N;i++){
        if(i==0){
            for(int j=0;j<3;j++){
                dp[i][j]=v[j][i];
            }
        }
        else{
            for(int j=0;j<3;j++){
                ll ma=dp[i-1][j];
                for(int l=0;l<3;l++){
                    if(j==l)continue;
                    else{
                        ma=max(ma,dp[i-1][l]+v[j][i]);
                    }
                }
                dp[i][j]=ma;
            }
        }
    }
    cout << max(dp[N-1][0],max(dp[N-1][1],dp[N-1][2])) << endl;

}

Measured memory_bytes: 8056
#include<iostream>
#include<cstring>
#include<queue>
using namespace std;

typedef pair<int,int> P;
typedef pair<P,int> PP;

int spx[11],spy[11];
const int jux[12]={-2,-2,-2,2,2,2,-1,0,1,-1,0,1};
const int juy[12]={-1,0,1,-1,0,1,-2,-2,-2,2,2,2};
int x,y,n;

bool pyon(){
	queue<PP> M;
	M.push(PP(P(x,y),1));
	while(!M.empty()){
		PP m=M.front();M.pop();
		int mx=m.first.first,my=m.first.second,ms=m.second;
		for(int a=0;a<12;a++){
			int nx=mx+jux[a],ny=my+juy[a];
			if(nx>=0 && nx<=9 && ny>=0 && ny<=9){
				if(nx>=spx[ms]-1 && nx<=spx[ms]+1 && ny>=spy[ms]-1 && ny<=spy[ms]+1){
					if(ms==n)return true;
					else{
						M.push(PP(P(nx,ny),ms+1));
					}
				}
			}
		}
	}
	return false;
}

int main(void){
	while(1){
		int a;
		scanf("%d%d",&x,&y);
		if(x==0 && y==0)break;
		scanf("%d",&n);
		for(a=1;a<=n;a++){
			int xx,yy;
			scanf("%d%d",&xx,&yy);
			spx[a]=xx,spy[a]=yy;
		}
		if(pyon())cout << "OK" << endl;else cout << "NA" << endl;
	}
    return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll s = 0;
    rep(i, n) s ^= a[i];
    ll ans = s;
    rep(i, n) a[i] &= ~s;

    // Gaussian Elimination under XOR operation (not under addition)
    int ranks = 0;
    vector<int> top(n);
    for (int i = 60; i >= 0; --i) {
        int j = ranks;
        for (; j < n; ++j) {
            if (a[j] >> i & 1) {
                swap(a[ranks], a[j]);
                break;
            }
        }
        if (j == n) continue;
        top[ranks] = i;
        rep(k, n) {
            if (ranks == k) continue;
            if (a[k] >> i & 1) a[k] ^= a[ranks];
        }
        ++ranks;
    }

    ll x = 0;
    for (int i = 60; i >= 0; --i) {
        ll nx = x | (1ll << i);
        ll b = nx;
        rep(j, ranks) {
            if (b >> top[j] & 1) b ^= a[j];
        }
        if ((b & nx) == 0) {
            x = nx;
        }
    }
    ans += x * 2;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {
    static int N;
    static int M;
    static int[] s;
    static int[] c;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        M = sc.nextInt();
        s = new int[M];
        c = new int[M];
        for(int i = 0; i < M; i++) {
            s[i] = sc.nextInt();
            c[i] = sc.nextInt();
            --s[i];
        }
        System.out.println(solve());
    }

    static String solve() {
        for(int i = 0; i <= 999; i++) {
            String str = String.valueOf(i);
            if(ok(str)) return str;
        }
        return "-1";
    }

    static boolean ok(String str) {
        if(N != str.length()) return false;
        for(int i = 0; i < M; i++) {
            if(str.charAt(s[i]) != (char)(c[i]+'0')) return false;
        }
        return true;
    }
}


Measured memory_bytes: 35724
#include <bits/stdc++.h>
using namespace  std;
int main()
  {
  int a ,b;
  cin>>a;
  for(int i = 1 ; i <=9;i++)
  {
    for(int j = 1; j <=9;j++)
    {
      if(i*j == a)
      {
        cout <<"Yes"<<endl;
        return 0;
      }
    }
  }
  cout <<"No"<<endl;
  }


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int a,b,c,temp;
  scanf("%d%d%d",&a,&b,&c);
  if(c>b){
    temp = c;
    c = b;
    b= temp;
    }
  if(b>a){
    temp = a;
    a = b;
    b= temp;
    }
  if(a == b+c){
    printf("Yes");
    }
  else
    printf("No");
  return 0;
 }
    
    

Measured memory_bytes: 128
/*input
1 2
*/
fn read_line() -> String {
    let mut return_ = format!("");
    std::io::stdin().read_line(&mut return_).ok();
    return_
}

fn main() {
    let v: Vec<i16> = read_line()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    if v[0] == v[1] {
        println!("a == b");
    } else if v[0] < v[1] {
        println!("a < b");
    } else if v[0] > v[1] {
        println!("a > b");
    }
}



Measured memory_bytes: 5024
#include <iostream>
using namespace std;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a + b == c || b + c == a || c + a == b) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
typedef long long ll;
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

template<typename T> //最大公約数
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T> //最小公倍数
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}

const int COM_MAX = 500500;
long long fac[COM_MAX],finv[COM_MAX],inv[COM_MAX];
void init(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < COM_MAX; i++){
        fac[i] = fac[i-1]*i%MOD;
        inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
        finv[i] = finv[i-1]*inv[i]%MOD;
    }
}
long long COM(int n,int k){
    if(n < k || n < 0 || k < 0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}


int main(){
    string s; int t;
    priority_queue<int> pq;
    vector<int> ans(0);
    while (true){
        cin >> s; 
        if (s == "end"){
            break;
        }
        if (s == "insert"){
            cin >> t;
            pq.push(t);
        } else {
            ans.push_back(pq.top());
            pq.pop();
        }
    }
    
    for (int i = 0; i < ans.size(); i++){
        cout << ans[i] << endl;
    }
}




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

#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f){cout<<(f?"YES":"NO")<<endl;}

int digit_sum(int n) {
    int s = 0;
    while (n != 0) s+=n%10,n/=10;
    return s;
}

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

    int N; cin >> N;
    Yes(N%digit_sum(N)==0);
}


Measured memory_bytes: 256