akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main()
{
	int n,m,i,j;
	char ch[10011][101];
	while (scanf("%d%d",&n,&m)!=EOF)
	{
		for (i=0;i<n;i++)
		scanf("%s",ch[i]);
			for (i=1;i<=m+2;i++)
		{
		 printf("#");
		 if (i==m+2)
		 printf("\n");
	}
	for (i=0;i<n;i++)
	printf("#%s#\n",ch[i]);
		for (i=1;i<=m+2;i++)
		{
		 printf("#");
		 if (i==m+2)
		 printf("\n");
	}
	}
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
int main()
{
	double a,b,c,d,e,f;
	double x,y;
	while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f) != EOF){
		x = (e*c-b*f) / (e*a-b*d);
		y = (c*d-a*f) / (b*d-e*a);
		if(x == -0.0) x = 0;
		if(y == -0.0) y = 0;
		printf("%.3f %.3f\n",x,y);
	}

	return 0;
}

Measured memory_bytes: 652
string = input().split()

ints = []

for c in string:
    ints.append(int(c))
    
N, A, B = ints[0], ints[1], ints[2]

classes = []

while len(classes) < N:
    i = input()
    if i in ('\n', ''):
        break
    classes.append(int(i))
    

soln = []
for c in classes:
    if c >= A and c < B:
        soln.append(c)

print(len(classes) - len(soln))


Measured memory_bytes: 3064
# https://atcoder.jp/contests/abc145/tasks/abc145_e
# なんとなくナップサック問題っぽい
# A分以内に食べきる事のできる最大の美味しさは？ならすぐにできる。
# 問題は最後のA分は必要ないこと

# →i番目の料理を最後に食べたときに、それ以外の料理でT分以内に食べることのできる美味しさの最大は？
# O(n^3) ∵ 各iについて(3000) × dp(3000*3000)
# →TLEしてしまいそう...


# 普通にナップサックして解いてから。もしiを最後に食べてたらの処理をする？
# ナップサック復元して、まだ食べてないもののなかから美味しさが最大のものを食べればよい！

'''
dp[i][j] ... 最大の美味しさの総和。[,i)の料理まで考慮したとき。j分以内に食べ終わることができる。
'''

import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_a_int(): return int(read())


def read_ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


# default import
from itertools import product, permutations, combinations


# ナップサック復元して、まだ食べてないもののなかから美味しさが最大のものを食べればよい！
# ただし注意として、

N, T = read_ints()
A, B = read_col(N)
tmp = list(zip(A, B))
tmp.sort()
A, B = map(list, zip(*tmp))
# print(A, B)

'''
dp[i][j] ... 最大の美味しさの総和。[,i)の料理まで考慮したとき。j分以内に食べ終わることができる。
'''

dp = [[0] * T for _ in range(N + 1)]

for i, j in product(ra(N), ra(T)):
    dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
    if j - A[i] >= 0:
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - A[i]] + B[i])

ans = 0
for i in ra(N):
    ans = max(ans, dp[i][-1] + B[i])
print(ans)

# # dp復元しながら食べた料理の美味しさを0に書き換える(あとでmaxを取るときに無視するため)
# i = N
# j = T - 1
# while i > 0:
#     if dp[i][j] == dp[i - 1][j]:  # 上から来たものだったらi-1番目のものは使ってない
#         pass
#     else:  # 斜めから来てたらi-1番目のものを使っている
#         B[i - 1] = 0  # 使ったものは美味しさを0にセットしておく
#         j -= A[i - 1]
#     i -= 1

# print(dp[-1][-1] + max(B))


Measured memory_bytes: 114908
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>/*toupperとかが入っている*/
#include<vector>/*可変長配列vectorのインクルード*/
using namespace std;/*標準名前空間を利用する。cinやcoutはこれによって利用可能になる*/

int N;
int W[100];

int main(void) {
  cin >> N;
  for(int i=0; i<N; i++){
    cin >> W[i];
  }
  
  int S1=0;
  int S2=0;
  for(int i=0; i<N; i++){
    S2=S2+W[i];
  }
  
  int min=100000;
  for(int i=0; i<N; i++){
    S1=S1+W[i];
    S2=S2-W[i];
    int tmp = abs(S1-S2);
    if(tmp<min){
      min=tmp;
    }
  }
  
  cout << min << endl;
  return 0;
}


Measured memory_bytes: 256
import queue

#K = list(map(int, input().split()))
K = int(input())

q = queue.Queue()
for i in range(1,10):
    q.put(i)

for i in range(K):
    x = q.get()
    if x % 10 != 0:
        q.put(10 * x + (x % 10) - 1)
    q.put(10 * x + (x % 10))
    if x % 10 != 9:
        q.put(10 * x + (x % 10) + 1)
print(x)

Measured memory_bytes: 12452
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cassert>
using namespace std;
#define MOD 1000000007

class Comb{
    // fact_num[i] = i! % MOD
    // fact_denpow[i] = (i**(MOD-2)) % MOD
    // fact_den[i] = fact_denpow[i]! % MOD
    // nCm = fact_num[n] * fact_den[m] * fact_den[n-m]
    // で計算できる（MODを適切に取る）
    // テーブルを作るのに O(NlogN)
    // 計算は O(1)
    int N;
    vector<long long> fact_num, fact_den;
    long long bipow(long long n, long long m) {
        if (m == 0) return 1;
        if (m % 2 == 0) {
            n = (n * n) % MOD;
            return bipow(n, m / 2) % MOD;
        } else
            return (n * bipow(n, m - 1)) % MOD;
    }
    void set_table(){
        fact_num.resize(N+1, 0);
        fact_den.resize(N+1, 0);
        vector<long long> fact_denpow(N+1, 0);

        fact_num[0] = 1;
        for(int i=1; i<=N; i++) fact_num[i] = (fact_num[i-1] * i) % MOD;
        for(int i=0; i<=N; i++) fact_denpow[i] = bipow(i, MOD-2);
        fact_den[0] = 1;
        for(int i=1; i<=N; i++) fact_den[i] = (fact_den[i-1] * fact_denpow[i]) % MOD;
    }
public:
    Comb(int N): N(N) { set_table(); }
    // nCk
    long long calc(long long n, long long k){
        if(k > n) return 0;
        return ((fact_num[n] * fact_den[k]) % MOD * fact_den[n-k]) % MOD;
    }
};

int main(){
    int N, K;
    cin >> N >> K;
    Comb comb(N);
    for(int i=1; i<=K; i++){
        long long ans = (comb.calc(N-K+1, i) * comb.calc(K-1, i-1)) % MOD;
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

typedef long long ll;

#define rep(i, a, b) for (ll i = a; i < (ll)b; ++i)
#define digit(a) to_string(a).size()
#define INF 10e12
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;

const long long MOD = 1e9 + 7;

int main(void)
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int x, y;
    cin >> x >> y;
    string ans = "No";
    rep(i, 0, x + 1)
    {
        if (2 * (x - i) + 4 * i == y)
            ans = "Yes";
    }
    cout << ans << endl;
}

Measured memory_bytes: 3644
#include "bits/stdc++.h"
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;*/
//#define int long long
#define fastr ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i,a,b) for(int i = a; i < b; i++)
#define rrep(i,a,b) for(int i = (a-1); i >= b; i--) 
#define fi first
#define se second
#define tit(v,i,c) get<c>(v[i])
#define mt make_tuple 
#define pb push_back
#define mp make_pair
double jk=0.4;
#define power(x,y) pow(x,y)+jk
#define endl "\n"
#define mod 1000000007
#define N 1000000000
int in(){
int n;cin>>n;
return n;}
void _do_(){
		int k,a,b;
		cin>>k>>a>>b;
		int z=k-a%k;
		if(a+z<=b||a%k==0)cout<<"OK"<<endl;
		else cout<<"NG"<<endl;

}signed main(){fastr
//int tc=in();
int tc=1;
while(tc--)_do_();
cerr<<"Time elapsed:";
cerr<<1000*clock()/CLOCKS_PER_SEC<<" ms\n";
return 0;}

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

namespace ConsoleApp106 {
    class Program {
        static void Main(string[] args) {
            int N = int.Parse(Console.ReadLine());

            var a = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long sum = a.Sum();

            long[] E = new long[N + 3];

            E[0] = a[0];

            for (int i = 1; i < N; i++) {
                E[i] = E[i - 1] + a[i];
            }

            long ans = Math.Abs(sum - 2 * a[0]);
            long kari = 0;

            for (int i = 0; i < N - 1; i++) {
                kari = Math.Abs(sum - 2 * E[i]);
                ans = Math.Min(ans, kari);
            }
            Console.WriteLine(ans);

        }
    }
}


Measured memory_bytes: 34116
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <fstream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <assert.h>


using namespace std;


#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define clr(a) memset((a),0,sizeof(a))
#define nclr(a) memset((a),-1,sizeof(a))
#define pb push_back
#define INRANGE(x,s,e) ((s)<=(x) && (x)<(e))
#define MP(a,b) make_pair((a),(b))

int main(){
	int n;
	while(cin>>n,n){
		vector<int> S1(n), S2(n), B(10000,0);
		int count=0;
		rep(i,n){
			cin>>S1[i];
		}
		while(1){
			rep(i,B.size())B[i]=0;
			
			rep(i,S1.size())
				B[S1[i]]++;
			
			for(int j=0;j<S1.size();j++){
				S2[j]=B[S1[j]];
			}
			if(S1==S2){ 
				break;
			}
			S1=S2;count++;
		}
		cout<<count<<endl;
		rep(i,S1.size()-1)
			cout<<S1[i]<<" ";
		cout<<S1[S1.size()-1]<<endl;
	}
	return 0;
}

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

int n;

int main() {

// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	// int T;
	// cin>>T;
	// while (T--) {
	
 //    }
	string x;
	cin>>x;
	cout<<x.substr(0, 3)<<endl;
}




Measured memory_bytes: 3596
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

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

        final int n = sc.nextInt();
        final int m = sc.nextInt();

        final int[] p = new int[m];
        final String[] s = new String[m];
        Map<Integer, int[]> map = new HashMap<>();
        for (int i = 0; i < m; i++) {
            p[i] = sc.nextInt();
            s[i] = sc.next();
            if (!map.containsKey(p[i])) {
                map.put(p[i], new int[2]);
            }
            if ("AC".equals(s[i])) {
                map.put(p[i], new int[]{ ++map.get(p[i])[0], map.get(p[i])[1] });
            }
            if ("WA".equals(s[i]) && map.get(p[i])[0] == 0) {
                map.put(p[i], new int[]{map.get(p[i])[0], ++map.get(p[i])[1]});
            }
        }

        int ok = 0;
        int ng = 0;
        for (Map.Entry<Integer, int[]> entry: map.entrySet()) {
            if (entry.getValue()[0] > 0) {
                ok++;
                ng += entry.getValue()[1];
            }
        }

        System.out.println(ok + " " + ng);
    }
}


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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
}*/

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

  vi a(n+1);
  rep(i, 1, n+1) cin >> a[i];

  vi v(n+1), w(n+1);
  for(int i = n; i > 0; i--){
    int t = 0;
    for(int j = i; j <= n; j += i){
      t += v[j];
    }
    v[i] = a[i] != (t%2);
  }

  vi ans;
  rep(i, 1, n+1) if(v[i]) ans.pb(i);

  cout << ans.size() << endl;
  rep(i, 0, ans.size()){
    cout << ans[i] << " \n"[i==ans.size()-1];
  }

  return 0;
}


Measured memory_bytes: 6516
N = int(input())
List = []
for i in range (2):
  List.append(list(map(int, input().split())))
sumList1 = [0]*N
sumList2 = [0]*N
for i in range(N):
  if i == 0:
    sumList1[i] = List[0][i]
    sumList2[N-1-i] = List[1][N-1-i]
  else:
    sumList1[i] = List[0][i]+sumList1[i-1]
    sumList2[N-1-i] = List[1][N-1-i]+sumList2[N-i]
res = 0
for i in range(N):
  res = max(sumList1[i]+sumList2[i],res)
print(res)

Measured memory_bytes: 9232
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
using mpint = mp::cpp_int; // 多倍長整数（任意精度）

/*
 * 定数
 */
const long double PI = (acos(-1));
const long double EPS = 1e-10;
const long long INF = 1e18;

/*
 * データ変換 
 */
/* char -> int */
int ctoi(char c) { return (int)(c - '0'); }

/*
 * 数学的な計算
 */
/* 階乗 */
int factorial(int n){ int ret = 1; for(int i = 1; i < n + 1; ++i) { ret = ret * i; } return ret; }

/* 最大公約数 */
template <typename T>T gcd(T x, T y){ return x % y == 0 ? y : gcd(y, x % y); }

/* 最小公倍数 */
template <typename T>T lcm(T a, T b) { return a * b / gcd(a, b); }

/* n個の整数の最小公倍数 */
template <typename T>T lcm_n(vector<T> &numbers) { T l; l = numbers[0]; for(int i = 1; i < numbers.size(); ++i) { l = lcm(l, numbers[i]); } return l; }

/*
 * DP向け
 */
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

/*
 * グラフ
 */
class Graph {
   public:
    vector<vector<int>> G;
    vector<int> Trans;
    vector<int> inDeg;
    int numV;
 
    Graph(int numV) {
        this->numV = numV;
        inDeg.assign(numV, 0);
        Trans.assign(numV, 0);
        G.assign(numV, vector<int>());
    }
 
    int topologicalSort(int v, vector<int> &dp) {
        if (dp[v] != -1) {
            return dp[v];
        }
 
        int res = 0;
 
        for (auto to : G[v]) {
            chmax(res, topologicalSort(to, dp) + 1);
        }
 
        return dp[v] = res;
    }
};

int main(){
  ll N, K;
  cin >> N >> K;

  ll ans = 0;
  for(ll i = K; i <= N+1; ++i){
    ans += i*(N+1-i)+1;
    ans %= 1000000007;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include<string>
#include<string.h>
#include<algorithm>
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

#define INF INT_MAX/3
#define vc vector<int>
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 2*acos(0.0)
#define ll long long
#define eps 1e-14
int dx[] = { 1,-1,0,0,0 };
int dy[] = { 0,0,1,-1,0 };


int x[10];
vc ans;
void solve() {
	int left, r;
	left = x[0];
	r = 0;
	//?????¨?????§??§??????????????§?????¶??????????????´???????????\??????
	for (int i = 1; i < 10; i++) {
		//???????????¶??????????????????
		if (left > x[i] && r > x[i]) {
			//cout << "NO" << endl;
			ans.push_back(0);
			return;
		}
		//?????????????????¶????????????
		if (x[i] < left && r < x[i]){
			r = x[i];
			continue;
		}
		else if (x[i] < r&&left < x[i]) {
			left = x[i];
			continue;
		}
		else { //???????????????????????´???
			if (r < left) {
				left = x[i];
				continue;
			}
			else {
				r = x[i];
				continue;
			}
		}
		
	}
	//cout << "Yes" << endl;
	ans.push_back(1);
}

int main() {
	int n;
	cin >> n;
	REP(i, n) {
		REP(j, 10)
			cin >> x[j];
		solve();
	}
	for (int i = 0; i < ans.size(); i++) {
		if (ans[i] == 0)
			cout << "NO" << endl;
		else
			cout << "YES" << endl;
	}
	return 0;
}

Measured memory_bytes: 3108
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define int                 long long   
#define double              long double
#define endl                "\n"
#define pb                  push_back
#define PI                  3.1415926535897932384626433832795l
#define F                   first
#define S                   second
#define mp                  make_pair
#define f(i,n)              for(int i=0;i<n;i++)
#define fastio              ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)              (v).begin(),(v).end()
#define rall(v)             (v).rbegin(),(v).rend()
#define gcd(a,b)            __gcd((a),(b))
#define fill(a,value)       memset(a,value,sizeof(a));
#define minn(v)             *min_element(v.begin(), v.end());
#define maxx(v)             *max_element(v.begin(), v.end());
#define print(x)            cout<<(x)<<endl;
#define sum(v)+x            accumulate(v.begin(), v.end(),x);
#define debug(x)            cout<<#x<<'='<<(x)<<endl;
typedef pair<int,int> pii;  
typedef vector<int> vi;

signed main() 
{
    fastio;
    cout << fixed << setprecision(12);
    int n;
    cin>>n;
    vi a(n);
    f(i,n)cin>>a[i];
    int x=0;
    f(i,n)
    {
        if(a[i]!=(i+1))x++;
    }
    if(x>2)print("NO")
    else print("YES")
    
    
    
    
    
    return 0;
}

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

using namespace std;
int a[15];
int main()
{
    cin.tie(0);cout.tie(0);
    ios::sync_with_stdio(false);
    int n;int k;
    cin >> n >> k;
    int temp;
    while(k--){
        cin >> temp;
        a[temp] ++;
    }

    for (int i=n;;++i){
        int temp = i;
        while (temp){
            if (a[temp%10]){
                break;
            }else temp /=10;
        }
        if (temp==0) {
            cout << i;
            break;
        }

    }
    return 0;
}


Measured memory_bytes: 3616
#include<iostream>
#include<string>
#include<cmath>
#include<cctype>
#include<cstdlib>

using namespace std;

int i;
string str;

bool dfs()
{
	bool flag = true;
	if(str[i] == 'm')
		i++;
	else 
		return false;
	
	
	if(str[i] == 'm')
		flag = dfs();
	if(str[i] == 'e')
		i++;
	else
		return false;
	
	if(!flag)return false;
	
	if(str[i] == 'm')
		flag = dfs();
	if(str[i] == 'w')
		i++;
	else
		return false;
	
	if(!flag)return false;
	
	return true;
	
}

int main()
{
	cin >> str;
	i = 0;
	if(dfs() && str[i] == '\0')cout << "Cat" << endl;
	else cout << "Rabbit" << endl;
	
	return 0;
}

Measured memory_bytes: 3160
#include<iostream>
#include<cstdio>
#include<functional>
#include<cstring>
#include<string>
#include<vector>
#include<queue>
#include<cmath>
#include<algorithm>
#include<map>
#include<ctime>
using namespace std;
typedef long long ll;
typedef long double ld;
const int maxn = 1e5+3;
const int inf = 1e5;
const int modn = 1e9+7;
const ld eps = 1e-8;
const long double PI = acos(-1.0);
void qRead(ll &x){x = 0;char a;for(a = getchar();a <'0' || a > '9';a = getchar());for(;a >= '0' && a <= '9';a = getchar())x = x*10 + a-'0';}
void qRead(int &x){x = 0;char a;for(a = getchar();a <'0' || a > '9';a = getchar());for(;a >= '0' && a <= '9';a = getchar())x = x*10 + a-'0';}
ll qpow(ll a,ll b,ll mo = modn){
//    printf("%lld\n",mo);
    ll res = 1;
    while(b){
        if(b & 1)res = (res*a) % mo;
        a = (a*a) % mo;
        b >>= 1;
    }
    return res;
}
ld qpow(ld a,ll b){
    ld res = 1;
    while(b){
        if(b & 1)res *= a;
        a = a*a;
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b){
    if(!b)return a;
    return gcd(b,a%b);
}
//ll vis[maxn],prime[maxn],cnt,smallP[maxn];
//void getPrime(int n){
//    cnt = 0;
//    for(int i = 1;i <= n;i++)vis[i] = 0;
//    for(ll i = 2;i <= n;i++){
//        if(!vis[i]){
//            prime[++cnt] = i;
//            smallP[i] = i;
//        }
//        for(int j = 1;j <= cnt && i*prime[j] <= n;j++){
//            vis[prime[j]*i] = 1;
//            smallP[prime[j]*i] = prime[j];
//            if((i % prime[j]) == 0)break;
//        }
//    }
//}
int main(){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    int cnt1 = 0,cnt2 = 0;
    if(a == 5)cnt1++;
    else if(a == 7)cnt2++;
    if(b == 5)cnt1++;
    else if(b == 7)cnt2++;
    if(c == 5)cnt1++;
    else if(c == 7)cnt2++;
    if(cnt1 == 2 && cnt2 == 1)printf("YES\n");
    else printf("NO\n");
}


Measured memory_bytes: 256
/*
    # Gir bhi gyaa bhai tera uthke phir machaayega
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
//#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define se second
#define fi first
#define pai acos(-1)
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x,s) for(i=x;i>=s;i--)
#define fit(itr,s) for(itr=s.begin();itr!=s.end();itr++)
#define W while
#define pp pair<ll,ll>
#define ppi pair<int,int>
#define vl vector<ll>
#define vll vector<pp >
#define vi vector<int>
#define vii vector<ppi>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define debug(x) cerr<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#define boost  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
const ll MAX=1e4;
const ll MM=1e18;
const ll mod=1e9+7;

ll expo(ll x,ll n,ll M=mod)
{
    ll ans=1;
    while(n>0)
    {
        if(n&1){ans=(ans*x)%M;}
                x=(x*x)%M;
                n>>=1;
    }
    return ans;
}


void solve()
{
   ll a,b,n,i;
   cin>>a>>b>>n;
  ll left=0,right=n,ans=-MM;
  W(left<=right)
  {
      ll mid=(left+right)/2;
      ll val=((a*mid)/b)-(a*(mid/b));
      if(val>=ans)
      {
          ans=val;
          left=mid+1;
      }
      else
        right=mid-1;
  }
  cout<<ans<<endl;


}


int main()
{
  boost;
  int t=1;
  //cin>>t;
  while(t--)
  {
      solve();
  }
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> void amax(T &x, T y) { x = max(x, y); }
template <typename T> void amin(T &x, T y) { x = min(x, y); }
template <typename T> T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

const int INF = 1001001001;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

void solve() {
  int d, g;
  cin >> d >> g;
  vi32 p(d), c(d);
  rep(i, d) {
    cin >> p[i] >> c[i];
  }
  int ans = 1e9;
  rep(i, bit32(d)) {
    int sum = 0;
    int ret = 0;
    using P = pair<int, int>;
    vector<P> rest;
    rep(j, d) {
      if (bit32(j) & i) {
        sum += (j + 1) * 100 * p[j] + c[j];
        ret += p[j];
      } else {
        rest.emplace_back(100 * (j + 1), p[j] - 1);
      }
    }
    reverse(all(rest));
    if (sum < g) {
      rep(j, sz(rest)) {
        int point, count;
        tie(point, count) = rest[j];
        // sum + c * point >= g
        // c * point >= g - sum
        // c >= (g - sum) / point
        int c = (g - sum + point - 1) / point;
        if (c <= count) {
          sum += point * c;
          ret += c;
          break;
        }
        sum += point * count;
        ret += count;
      }
    }
    if (sum >= g) {
      amin(ans, ret);
    }
  }
  cout << ans << endl;
}


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

long T[MAX];
int n, k;

int check(int p)
{
    int i = 0;
    long long sum;
    for (int j = 0; j < k; j++) {
        sum = 0;
        while (sum + T[i] <= p) {
            sum += T[i];
            i++;
            if (i == n) return n;
        }
    }
    return i;
}


int main(int argc, char const *argv[])
{
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        cin >> T[i];
    }
    long long left = 0;
    long long right = 10000 * 100000;
    long long mid; 
    while (right - left > 1) {
        mid = (left + right) / 2;
        int v = check(mid);
        if (v >= n) {
            right = mid;
        } else {
            left = mid;
        }
    }

    cout << right << endl;

    return 0;
}




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

class B
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		var ss = new int[n].Select(_ => Console.ReadLine()).OrderBy(s => s.Length).ToArray();

		var r = 0L;
		var nodes = new List<int[]> { new int[26] };
		var ends = new List<int[]> { new int[26] };

		foreach (var s in ss)
		{
			var id = 0;
			for (int i = s.Length - 1; i >= 0; i--)
			{
				if (i == 0)
					ends[id][s[i] - 'a']++;
				else
					for (int j = 0; j < 26; j++)
					{
						if (ends[id][j] == 0) continue;
						var c = (char)('a' + j);
						if (s.IndexOf(c, 0, i + 1) >= 0)
							r += ends[id][j];
					}

				var nextId = nodes[id][s[i] - 'a'];
				if (nextId == 0)
				{
					nodes[id][s[i] - 'a'] = nodes.Count;
					id = nodes.Count;
					nodes.Add(new int[26]);
					ends.Add(new int[26]);
				}
				else
				{
					id = nextId;
				}
			}
		}
		Console.WriteLine(r);
	}
}


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

using namespace std;
static const int SIZE = 8;
static const int FREE = 0;
static const int NOT_FREE = 1;

vector<int> row(SIZE, FREE);
vector<int> col(SIZE, FREE);
vector<int> slopeUpperRight(2 * SIZE - 1, FREE);
vector<int> slopeLowerLeft(2 * SIZE - 1, FREE);
vector< vector<char> > field(SIZE, vector<char>(SIZE));

void printBoard()
{
	for (int i = 0; i < SIZE; ++i)
	{
		for (int j = 0; j < SIZE; ++j)
		{
			cout << field[i][j];
		}
		cout << endl;
	}
}

void dfs(int r)
{
	if (r == SIZE)
	{
		printBoard();
		return;
	}
	if (row[r] == NOT_FREE)
	{
		dfs(r + 1);
		return;
	}
	for (int i = 0; i < SIZE; ++i)
	{
		if (col[i] == NOT_FREE || 
			slopeUpperRight[r + i] == NOT_FREE ||
			slopeLowerLeft[r - i + SIZE - 1] == NOT_FREE)
		{
			continue;
		}
		row[r] = col[i] = slopeUpperRight[r + i] = slopeLowerLeft[r - i + SIZE - 1] = NOT_FREE;
		field[r][i] = 'Q';
		dfs(r + 1);
		row[r] = col[i] = slopeUpperRight[r + i] = slopeLowerLeft[r - i + SIZE - 1] = FREE;
		field[r][i] = '.';
	}
}

void solve()
{
	for (int i = 0; i < SIZE; ++i)
	{
		for (int j = 0; j < SIZE; ++j)
		{
			field[i][j] = '.';
		}
	}

	int n;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		int r, c;
		cin >> r >> c;
		field[r][c] = 'Q';
		row[r] = NOT_FREE;
		col[c] = NOT_FREE;
		slopeUpperRight[r + c] = NOT_FREE;
		slopeLowerLeft[r - c + SIZE - 1] = NOT_FREE;
	}
	dfs(0);
}

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



Measured memory_bytes: 3120
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 n = 1;
      int i ;
	 for(i = 0;n<b;i++){
	 	n+=a-1;
	 }
	 System.out.println(i);
    }
}

Measured memory_bytes: 22740
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# input
N = int( input() )
S = list()
for ii in range(N):
    S.append( input() )

# calc 
from collections import Counter
 
C       = Counter( S )
max_cnt = max(C.values())

words = list()
for word, cnt in C.items():
    if cnt == max_cnt:
        words.append(word)
words.sort()

print(*words, sep='\n')

Measured memory_bytes: 35852
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }



int main() {
	
	int n;
	
	cin >> n;
	map<string,int> mp;

	rep(i, n) {
		string s;
		cin >> s;
		mp[s]++;
	}
	
	int cnt = -1;
	
	for (auto x : mp) {
		int tmp = x.second;
		cnt = max(cnt, tmp);

	}
	vector<string> ans;
	for (auto x : mp) {
		int tmp = x.second;
		if (cnt == tmp) {
			ans.push_back(x.first);
		}
	}
	rep(i, ans.size()) cout << ans[i] << endl;

	return 0;
}


Measured memory_bytes: 26868
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int a[200010],b[200010];

int main(void){
	          int i;

	          int n,m;
	          cin >> n;
	          for(i=1;i<=n;i++) cin >> a[i];

	          m=n;
	          if(n%2==0){
	        	  for(i=1;i<=n/2;i++){
	        		  b[i]=a[m];
	        		  m--;
	        		  b[n-i+1]=a[m];
	        		  m--;
	        	  }
	          }else{
	        	  for(i=1;i<=n/2;i++){
	        		  b[i]=a[m];
	        		  m--;
	        		  b[n-i+1]=a[m];
	        		  m--;
	        	  }
	        	  b[(n+1)/2]=a[m];
	          }

	          for(i=1;i<n;i++){
	        	  cout << b[i] << ' ';
	          }

	          cout << b[n] << endl;


	          return 0;
}


Measured memory_bytes: 3712
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
        char[]ss = S.toCharArray();
        String A = sc.next();
        char[]a = A.toCharArray();
        String B = sc.next();
        char[]b = B.toCharArray();

			System.out.print(ss[0]);
			System.out.print(a[0]);
			System.out.println(b[0]);
		}
	}

Measured memory_bytes: 35440
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            int r = int.Parse(Console.ReadLine());
            Console.WriteLine(r * r);
        }
    }
}

//文字配列の取得
//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];

//文字列の取得
//string s = Console.ReadLine();

//数字配列の取得
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];

//数字の取得
//int N = int.Parse(Console.ReadLine());

//リスト型(int)の取得
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());

//出力
//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.WriteLine(cnt);



Measured memory_bytes: 27456
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n); i >= 0; i--)
#define loop(i, r, n) for (int i = (r); i < (n); i++)
#define pb push_back
#define all(in) in.begin(),in.end()

template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main(){
    ll n; cin >> n;
    vector<ll> a(n), b(n); rep(i,n) cin >> a[i], b[i] = a[i];

    vector<ll> dp(n+1,0); dp[0] = 1000;
    rep(jj,n){
        ll money = dp[jj];
        ll ans = 0;
        loop(i,jj,n){
            ll k = b[i];
            ll kane = money, kabu = 0;
            loop(j,jj,n){
                if(a[j] <= k){
                    kabu += kane / a[j];
                    kane %= a[j];
                }
                else{
                    kane += kabu * a[j];
                    kabu = 0;
                    chmax(dp[j+1],kane);
                }
            }
            kane += kabu * a[n-1];
            chmax(dp[n],kane);
        }
    }
    cout << dp[n] << endl;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int A1 = sc.nextInt();
		int A2 = sc.nextInt();
		int A3 = sc.nextInt();
		if (A1 + A2 + A3 >= 22) {
			System.out.print("bust");
		} else {
			System.out.print("win");
		}
	}
}


Measured memory_bytes: 21844
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
ans=0
flg=0
Ttmp=0
for i in range(N):
    if flg == 1:
        Atmp=Ttmp
    else:
        Atmp=A[i]
    flg=0
    Btmp=B[i]

    if Atmp <= Btmp:
        ans+=Atmp
        Btmp-=Atmp
    else:
        ans+=Btmp
        continue
    flg=1        
    if A[i+1] <= Btmp:
        ans+=A[i+1]
        Ttmp=0
    else:
        ans+=Btmp
        Ttmp=A[i+1]-Btmp

print(ans)

Measured memory_bytes: 18476
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
//const int inf = 1e9 + 7;
//int dy[] = {0, 0, -1, 1};
//int dx[] = {1, -1, 0, 0};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string a, b; cin >> a >> b;
    if (a.size() > b.size()) {
        cout << "GREATER" << endl;
        return 0;
    } else if (a.size() < b.size()){
        cout << "LESS" << endl;
        return 0;
    }
    if (a > b) {
        cout << "GREATER" << endl;
    } else if (a == b) {
        cout << "EQUAL" << endl;
    } else {
        cout << "LESS" << endl;
    }
    
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>

int main() {
  size_t N, M, Q;
  scanf("%zu %zu %zu", &N, &M, &Q);

  std::vector<std::vector<int>> A(N, std::vector<int>(N));
  for (size_t i = 0; i < M; ++i) {
    size_t L, R;
    scanf("%zu %zu", &L, &R);
    --L;
    --R;
    ++A[L][R];
  }

  std::vector<std::vector<int>> B(N+1, std::vector<int>(N+1));
  for (size_t i = 1; i <= N; ++i)
    for (size_t j = 1; j <= N; ++j)
      B[i][j] = B[i][j-1] + A[i-1][j-1];

  for (size_t i = 1; i <= N; ++i)
    for (size_t j = 1; j <= N; ++j)
      B[i][j] += B[i-1][j];

  for (size_t i = 0; i < Q; ++i) {
    size_t p, q;
    scanf("%zu %zu", &p, &q);
    --p;
    int res = B[q][q] - B[p][q] - B[q][p] + B[p][p];
    printf("%d\n", res);
  }
}


Measured memory_bytes: 2944
#include<iostream>
#include<cstdio>
using namespace std;
int a[1000001];
int main()
{
	int i,n,f=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
		if(a[i]%2==0)
		{
			if(a[i]%3==0||a[i]%5==0);
			else
				f=1;
		}	
	}
	if(f==1)
		cout<<"DENIED";
	else
		cout<<"APPROVED";
	return 0;
}

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

using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n);
  for(int i=0;i<n;i++)
    cin >> a[i] >> b[i] >> c[i];
  vector<int> dpa(n+1,0), dpb(n+1,0), dpc(n+1,0);
  for(int i=n-1;i>=0;i--){
    dpa[i] = max(dpb[i+1]+b[i], dpc[i+1]+c[i]);
    dpb[i] = max(dpa[i+1]+a[i], dpc[i+1]+c[i]);
    dpc[i] = max(dpa[i+1]+a[i], dpb[i+1]+b[i]);
  }
  cout << max(dpa[0], max(dpb[0], dpc[0]));
  return 0; 
}

Measured memory_bytes: 2560
N = int(input())

def lcm(x, y):
    M = x * y
    if x < y:
        x, y = y, x
    while y > 0:
        x, y = y, x % y
    return M // x
num = []
for _ in range(N):
    num.append(int(input()))
M = num[0]
for i in range(N):
    M = lcm(M, num[i])
print(M)


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

sys.setrecursionlimit(2 * 10 ** 6)


def dfs(x):
    global n, d, ops, dp
    if x in dp:
        return dp[x]
    res = d * x
    for num, cost in ops:
        res = min(res, dfs(x // num) + cost + d * (x % num))
        if x % num != 0:
            res = min(res, dfs(x // num + 1) + cost + d * (num - x % num))
    dp[x] = res
    return res


t = int(input())
for _ in range(t):
    n, a, b, c, d = map(int, input().split())
    ops = [[2, a], [3, b], [5, c]]
    dp = {0: 0, 1: d}
    print(dfs(n))


Measured memory_bytes: 11004
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n, m;
  cin >> n >> m;
  map<int, P> mp;
  map<P, string> targets;

  rep(i, 0, m) {
    int p, y;
    cin >> p >> y;
    P x = make_pair(p, y);
    mp[i] = x;

    stringstream ss;
    ss << setw(6) << setfill('0') << p;
    string sx = ss.str();
    targets[x] = sx;
  }

  int bef = 1, now = 0;
  for (auto target : targets) {
    if (bef == target.first.first)
      now++;
    else
      now = 1;

    stringstream ss;
    ss << setw(6) << setfill('0') << now;
    string sx = ss.str();
    targets[target.first] += sx;
    bef = target.first.first;
  }

  for (auto m : mp) {
    cout << targets[m.second] << endl;
  }
}


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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(void){
  int a, b;
  cin >> a >> b;
  cout << a*b << " " <<a+a+b+b << endl;
  return 0;
}

Measured memory_bytes: 1164
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF=10**9
def dfs(cur, a, b, c):
	if cur == N:
		return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
	ret0 = dfs(cur + 1, a, b, c)
	ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
	ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
	ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
	return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))

Measured memory_bytes: 3064
/* Aditya0412 */
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
#define pb push_back 
//#define pop pop_back
#define mp make_pair
#define ve vector
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpl vector < pll >
#define fi first
#define sz size 
#define len length 
#define se second 
//const ll mod=998244353;
const ll mod = 1000000000+7;
const ll N=1000000+6;
#define M_PI           3.14159265358979323846
bool f(string s)
{
	int n=s.length();
	bool bo=true;
	for(int i=0;i<n;i++)
	{
		if(s[i]!=s[n-1-i])
		{
			bo=false;
			break;
		}
	}
	return bo;
}
int main() 
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   
    double d;
    cin>>d;
    d/=3;
    d=(d*d*d);
    cout<<setprecision(24)<<d;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

typedef long long ll;
const int mod = 1000000007;
struct mint {
  ll x; // 
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main()
{
  int N, K;
  cin >> N >> K;
  mint ans = 0;
  combination comb(3 * 100000);
  mint min = 0;
  mint max = 0;
  rep(i, K)
  {
    min += i;
    max += N - i;
  }

  rep(i, N + 1 - K)
  {
    ans += max - min + 1;
    max += N - K - i;
    min += K + i;
  }
  cout << ans + 1 << endl;
  return 0;
}

Measured memory_bytes: 8012
import itertools

def solve():
  n = int(input())
  p = list(int(i) for i in input().split())
  q = list(int(i) for i in input().split())
  
  query = [int(i) for i in range(1,n+1)]
  tp = itertools.permutations(query,n)
  i = 0
  for tb in tp:
    i += 1
    if list(tb) == p:
      a = i
    if list(tb) == q:
      b = i
  print(abs(b-a))
          
solve()

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, A, B;
    cin >> N >> A >> B;
    cout << std::min(N * A, B) << endl;
    return 0;
}

Measured memory_bytes: 256
# dp[i][j](各マスの値) = i-1番目の品物の中からj円を支払うときの最小枚数
#  → 個数制限なし   
# <DP初期状態>
#   i\j  0   1   2    3   ...  n (お金(yen))
#   0    0  INF INF  INF  ... INF
#   1    0  INF INF  INF  ... INF
#                 ...
#   m-1  0  INF INF  INF  ... INF
#   m    0  INF INF  INF  ... INF
#  (i番目のコイン)
#
# <DP遷移式>
# if(j >= c_i):  c[i]のコイン採用可
#    dp[i+1] = min(dp[i][j-c[i]]+1     : c[i]を採用する(コイン枚数:1枚増える)
#                , dp[i][j])           : c[i]を採用しない
#                , dp[i+1][j-c[i]]+1)  : c[i]を重複を許して採用
# elif(j < c_j): money[i]のコイン採用不可
#    dp[i+1][j] = dp[i][j]              : c[i]を採用しない
 
n,m = map(int,input().split())
c = list(map(int,input().split()))
 
# DP配列の初期化    
dp = []
for i in range(m+100):
    tmp = [0]
    for j in range(n+99): tmp.append(float('inf'))
    dp.append(tmp)
    
# DP遷移    
for i in range(m):
  #print_dp(dp,i)  
  for j in range(n+1):
    if(j>=c[i]): # i番目のコイン採用可
      dp[i+1][j] = min(dp[i][j-c[i]]+1, 
                       dp[i][j],
                       dp[i+1][j-c[i]]+1)  
    else: # i番目のコイン採用不可
      dp[i+1][j] = dp[i][j]

#print_dp(dp,i+1)    
# 出力
print(dp[m][n])


Measured memory_bytes: 202132
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func min(a, b int) int {
	if a <= b {
		return a
	}
	return b
}

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

func yesno(result bool) {
	if result {
		fmt.Fprintln(write, "Yes")
	} else {
		fmt.Fprintln(write, "No")
	}
}

func printansStr(result bool, a, b string) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func printansInt(result bool, a, b int) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func main() {
	defer write.Flush()

	var n int
	fmt.Fscan(read, &n)

	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(read, &a[i])
	}
	sort.Ints(a)
	fmt.Fprintln(write, a[n/2]-a[n/2-1])
}


Measured memory_bytes: 1920
#include<iostream>
#include<algorithm>
#include<queue>
#include<cmath>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
ll inf = 100000000;
ll v[205];
ll x[20000005];
ll a[10005], b[10005];
ll dp[10005][10005];
int dx[4] = { 1,-1,0,0 };
int dy[4] = { 0,0,1,-1 };
typedef pair<ll, ll> P;

P ans(int x) {
	int a = x % 10;
	int b = 0;
	while (x) {
		b = x;
		x = x / 10;
	}
	return P(a, b);
}

int main() {
	int n;
	cin >> n;
	map<P, ll>v;
	for (int i = 1; i <= n; i++) {
		P p = ans(i);
		v[p]++;
	}
	ll sum = 0;
	for (int i = 1; i <= n; i++) {
		P p = ans(i);
		P q(p.second, p.first);
		sum += v[q];
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int d[90001];

int main(){
    int H, W, D; cin >> H >> W >> D;
    vector<pair<int, int>> A(H*W+5);

    for(int i=1; i<=H; i++){
        for(int j=1; j<=W; j++){
            int a; cin >> a;
            A[a].first = i; A[a].second = j;
        }
    }

    for(int i=D+1; i<W*H+1; i++){
        d[i] = d[i-D] + abs(A[i].first - A[i-D].first) + abs(A[i].second - A[i-D].second);
    }

    int q; cin >> q;
    vector<ll> ans(q);
    for(int i=0; i<q; i++){
        int L, R; cin >> L >> R;
        ans[i] = d[R] - d[L];
    }

    for(int i=0; i<q; i++) cout << ans[i] << endl;
}

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

 int main() {
	 
	 int a;
	 int b;
	 int k;
	 int n;

	 while (std::cin >> a >> b) {

		 k = 1;

		 n = a + b;

		 while (n >= 10) {
			 
			 n /= 10;
			 k += 1;

		 }
		 std::cout << k << std::endl;
	 }

}

Measured memory_bytes: 2948