akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {

	private void doit(){
		Scanner sc = new Scanner(System.in);
		long mod = 1000000007;
		while(sc.hasNext()){
			int n = sc.nextInt();
			int m = sc.nextInt();
			int []data = new int[n];
			int sum = 0;
			for(int i = 0;i < n; i++){
				data[i] = sc.nextInt();
				sum += data[i];
			}
			
			long [][] dp = new long[sum + 1][n + 1];
			
			for(int i = 0; i < n; i++){
				for(int j = sum ; j >= 0; j--){
					for(int k = 0; k < n; k++){
						if(dp[j][k] == 0)continue;
						
						int next = j + data[i];
						if(next > sum) continue;
						dp[next][k + 1] += dp[j][k];
					}
					
				}
				dp[data[i]][1] += 1;
			}
			
			long ans = 0;
			for(int i = 1; i <= n; i++){
				for(int j = 0; j < sum + 1; j++){
					if(dp[j][i] != 0 && (j / i == m && j % i ==0)){
						ans += dp[j][i];
					}
				}
			}
			System.out.println(ans);
		}

	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

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

}


Measured memory_bytes: 12004
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 9e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class AFrog1 {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int n;
	    in >> n;
	    vector<int> h(n);
	    for(int i=0; i<n; i++){
	        in >> h[i];
	    }

	    vector<ll> dp(n, inf);

	    dp[0] = 0;
	    for(int i=0; i<n; i++){
	        if(i+1 < n) chmin(dp[i+1], dp[i] + abs(h[i+1]-h[i]));
	        if(i+2 < n) chmin(dp[i+2], dp[i] + abs(h[i+2]-h[i]));
	    }

	    out << dp[n-1] << endl;
	}
};


int main() {
	AFrog1 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,M;
    cin >> N >> M;
    vector<int> A(N+1);
    for(int i=1; i<=N; i++) cin >> A[i];
    for(int k=1; k<=M; k++){
        for(int i=1; i<N; i++){
            if(A[i]%k > A[i+1]%k){
                swap(A[i],A[i+1]);
            }
        }
    }
    for(int i=1; i<=N; i++){
        cout << A[i] << enld;
    }
    return 0;
}


Measured memory_bytes: 3136
#include<iostream>
using namespace std;
const int maxn = 1e5;
long long n, m;
int main()
{
	cin >> n >> m;
	if (n == 1) {
		if (m ==1)cout << 1;
		else cout << m - 2;
	}
	else if (m == 1) {
		if (n ==1)cout << 1;
		else cout << n - 2;
	}
	else {
		long long cnt = (n - 2)*(m - 2);
		cout << cnt;
	}
	return 0;
}

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

static const int MAX = 200005;

int main() {
  int N;
  int X[MAX], Y[MAX];

  cin >> N;
  rep(i, N) cin >> X[i];

  memcpy(Y, X, sizeof(X));

  sort(X, X + N);

  int left, right;
  left = X[N / 2 - 1];
  right = X[N / 2];

  rep(i, N) {
    if (Y[i] <= left) cout << right << endl;
    else cout << left << endl;
  }

  return 0;

}

Measured memory_bytes: 3712
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<set>
#include <bits/stdc++.h>

using namespace std;
using ll = long long int;

int main(void){
  
  ll n,m;
  cin>>n>>m;

  ll sum = 0;
  vector<ll> a(n);

  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    a[i] = x;
    sum += x;
  }

  ll ans = 0;

  for(int i=0;i<n;i++){
    if(a[i]>=((double)sum/(double)(4*m))) ans++;
  }
  if(ans>=m) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long int ll;
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) { a = b; return 1; }return 0; }
#define all(a)  (a).begin(),(a).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define vll vector<ll>
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
const ll INF =1LL << 62;

int main(){
  int A,B,C;
  cin >> A >> B >> C;
  if(A == B && B == C)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
  

Measured memory_bytes: 768
#!/usr/bin/python3
# vim: set fileencoding=utf-8:

import sys


def main():
    S = input()
    AA = int(S[:2])
    BB = int(S[2:])

    ay = is_year(AA)
    am = is_month(AA)
    by = is_year(BB)
    bm = is_month(BB)

    ans = "Error"
    if (ay and bm) == True and (by and am) == False:
        ans = "YYMM"
    elif (ay and bm) == False and (by and am) == True:
        ans = "MMYY"
    elif (ay and bm) == True and (by and am) == True:
        ans = "AMBIGUOUS"
    else:
        ans = "NA"

    print(ans)


def is_year(num):
    return True


def is_month(num):
    ret = False
    if 1 <= num <= 12:
        ret = True

    return ret


if __name__ == "__main__":
    main()


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

int main(){
  int N,M,X,Y;
  cin >> N >> M >> X >> Y;
  vector<int> x(N),y(M);
  for(int i=0;i<N;i++){
    cin >> x.at(i);
  }
  for(int i=0;i<M;i++){
    cin >> y.at(i);
  }
  sort(x.begin(),x.end());
  sort(y.begin(),y.end());
  if(max(x.back(),X)>=min(y.front(),Y)){
    cout << "War" << endl;
  }else{
    cout << "No War" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdlib.h>
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>

int search(int x, int array[], int N)
{
    for (int i = 0; i < N; i++)
    {
        if (x == array[i])
            return 1;
    }

    return 0;
}

int main()
{
    int X, N;

    scanf("%d %d", &X, &N);

    int arr[101];
    int p[N];

    if (X == 0)
    {
      printf("-1");
      return 0;

    } 

    if (N == 0)
    {
        printf("%d", X);
        return 0;
    }

    for (int i = 0; i < 101; i++)
    {
        arr[i] = 200;
    }

    for (int i = 0; i < N; i++)
    {
        scanf("%d", &p[i]);
    }

    for (int i = 0; i <= 101; i++)
    {
        if (search(i, p, N) == 0)
            arr[i] = i ;
    }

    //     for (int i = 0; i < 100; i++)
    //         {
    //             printf("%d  ",arr[i]);
    //         }
    //   printf("\n");
    for (int i = 0; i <= 101; i++)
    {
        if (arr[i] != 200)
        {
            arr[i] = abs(X - arr[i]);
        }
    }
    
    int min = INT_MAX;
    int idx = 0;

    //    for (int i = 0; i <= 101; i++)
    //     {
    //         printf("%d | ",arr[i]);
    //     }
    // printf("\n");

    for (int i = 0; i <= 101; i++)
    {
        if (arr[i] != 200)
        {
            if (min > arr[i])
            {
                min = arr[i];
                idx = i;
            }
        }
    }

    printf("%d", idx );
}

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

//Function Macros:
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

//Type Definitions:
typedef long long ll;
typedef unsigned long long ull;

//Constants:
const int INF = 2e9;
const int MOD = 1e9 + 7;

//Global Variables:

//Prototype Declarations:
int gcd(int, int);

//================ Main Loop ================
int main()
{
    int n, k, b, ans = 0;
    cin >> n >> k;
    rep(i, n){
        cin >> b;
        if(b >= k){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}
//===========================================

//Functions:
int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}

Measured memory_bytes: 256
require 'prime'
N = gets.to_i
h = {}
(2..N).map{ |x|
  x.prime_division.each{ |q,n| h[q] = (h[q] || 0) + n }
  #p h
}
p h.values.reduce(1){ |a,x| a * (x + 1) % 1000000007 }

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

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

void init(){
  nil = (NodePointer)malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  t->next->prev = t->prev;
  t->prev->next = t->next;
  free( t );
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  NodePointer t = nil->prev;
  if( t == nil ) return;
  deleteNode( t );
}

void mydelete(int key){
  for( NodePointer h = nil->next; h != nil; h = h->next ){
    if( h->key == key ){
      deleteNode( h );
      break;
    }
  }
}


void insert(int key){
  NodePointer x;
  x = (NodePointer)malloc(sizeof(struct node));
  x->key = key;

  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;


}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	mydelete(key); nd++; 
      }
      size--;
    }
  }

  printList();
  return 0;
}



Measured memory_bytes: 34388
#include <stdio.h>
int main() {
    int i, h, m, s;
    scanf("%d",&i);
    h = i/3600;
    m = (i - 3600*h)/60;
    s = i - 3600*h - 60*m;
    printf("%d:%d:%d\n", h, m, s);
    return 0;
}


Measured memory_bytes: 2076
N = int(input())
x = 0

for i in range(1,N+1):

    if i%3 == 0:
            print(" %d"%i,end = "");
    else:
        x = i
        while (x):
            if x%10 == 3:
                print(" %d"%i,end = "")
                break
            x //= 10
print()


Measured memory_bytes: 5876
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
typedef struct { long x, y; } pt;

void solve() {

}

int main() {
    int n; cin >> n;
	switch (n % 10)
	{
	case 2: case 4: case 5: case 7: case 9:
		cout << "hon" << endl;
		break;
	case 0: case 1: case 6: case 8:
		cout << "pon" << endl;
		break;
	case 3:
		cout << "bon" << endl;
		break;
	default:
		break;
	}
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;

int main() {
  int N, K;
  cin >> N >> K;
  int h[100010];

  for (int i=0; i<N; i++) {
    cin >> h[i];
  }

  sort(h, h+N); //昇順にソート
  int ans = INF;

  for (int i=0; i<N-K+1; i++) {
    ans = min(ans, h[i+K-1] - h[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
n=int(input())
c=[]
sf=[]
for _ in range(n-1):
    ci,s,f=map(int,input().split())
    c.append(ci)
    sf.append([s,f])
for i in range(n):
    temp=0
    for j in range(i,n-1):
        if temp<=sf[j][0]:
            temp=sf[j][0]+c[j]
        else:
            if temp%sf[j][1]==0:
                temp=temp+c[j]
            else:
                temp=temp+(sf[j][1]-temp%sf[j][1])+c[j]
            
    print(temp)
        

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

const long long MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    string s1, s2;
    cin >> s1 >> s2;

    if (n == 1) {
        cout << 3 << endl;
        return 0;
    }

    long long ans;
    int left;
    if (s1.at(0) == s1.at(1)) {
        ans = 6;
        left = 2;
    }
    else {
        ans = 3;
        left = 1;
    }

    for (int i = left; i < n; i++) {
        if (i + 1 < n) {
            if (s1.at(i) == s1.at(i + 1)) {
                if (s1.at(i - 1) == s2.at(i - 1)) {
                    ans *= 2;
                    ans %= MOD;
                }
                else {
                    ans *= 3;
                    ans %= MOD;
                }
            }
            else {
                if (s1.at(i - 1) == s2.at(i - 1)) {
                    ans *= 2;
                    ans %= MOD;
                }
            }
        }
        else {
            if (s1.at(i - 1) == s2.at(i - 1)) {
                    ans *= 2;
                    ans %= MOD;
                }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD (1000000007)
#define MOD2 (998244353)
#define MOD3 (1000000009)
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
ifstream cinn("in.txt");ofstream coutt("out.txt");
int poww(const int &a,int b,const int &m=MOD){if(b==0)return 1;int x=poww(a,b/2,m);x=x*x%m;if(b&1)x=x*a%m;return x;}
int ceil(const int &a,const int &b){return (a+b-1)/b;}
////Read:
//Use __builtin_popcountll for ll;
//Check corner cases, n==1;
//
////Some function:
//__builtin_popcountll(), 

string s="abcdefghijklmnopqrstuvwxyz";

signed main(){
    FASTER;
    int n;cin>>n;
    string ans="";
    while(n>0){
        n--;
        int rem=n%26;
        ans = s[rem] + ans;
        n = (n - rem) / 26;
    }
    
    cout<<ans;
}



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

using namespace std;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1000000007;

using ll = long long;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int h, w;
    cin >> h >> w;

    int a, b;
    cin >> a >> b;

    ppp(h*w-(a*w+b*h)+a*b);


    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }
void uniq(VI& es) { sort(ALL(es)); es.erase(unique(ALL(es)), es.end()); }

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N;
	string s;
	while(cin>>N) {
		map<string,ll> h;
		REP(i, N) {cin>>s;h[s]++;}
		cin>>N;
		REP(i, N) {cin>>s;h[s]--;}
		ll ans=0;
		for(auto kv: h) maxUpdate(ans, kv.SE);
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int a = scanner.nextInt();
        if (a >= 10) {
            System.out.println(-1);
            return;
        }

        final int b = scanner.nextInt();
        if (b >= 10) {
            System.out.println(-1);
            return;
        }

        System.out.println(a * b);
    }
}


Measured memory_bytes: 23636
#include<bits/stdc++.h>
using namespace std;
int main(){
int n, m, a[100][100], b[100], c[100];
cin >> n >> m;
 for( int i = 0; i < n; i++)
  for( int j = 0; j < m; j++) cin >> a[i][j];
 for( int i = 0; i < m; i++) cin >> b[i];
 for( int i = 0; i < n; i++){
  c[i] = 0;
  for( int j = 0; j < m; j++){
   c[i] += a[i][j]*b[j];
  }
  }
 for( int i = 0; i < n; i++) cout << c[i] << endl;
 return 0;
}

Measured memory_bytes: 3132
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define inf 1001001001001000
using namespace std;


int main(void){
    ios::sync_with_stdio(false); cin.tie(nullptr);
    ll h,n;
    cin>>h>>n;
    vl a(n),b(n);
    rep(i,n) cin>>a[i]>>b[i];
    vvl dp(n,vl(h+1,inf));
    rep(i,n){
        dp[i][0] = 0;
        rep1(j,h+1){
            if(i==0){
                if(j%a[i] == 0){
                    dp[i][j] = (j/a[i])*b[i];
                }
                else{
                    dp[i][j] = (j/a[i]+1)*b[i];
                }
            }
            else{
                dp[i][j] = min({dp[i-1][j],dp[i-1][max(0LL,j-a[i])]+b[i],dp[i][max(0LL,j-a[i])]+b[i]});
            }
        }
    }
    //rep(i,n) rep(j,h+1) cout<<"dp["<<i<<"]["<<j<<"]="<<dp[i][j]<<endl;
    cout<<dp[n-1][h]<<endl;
}


Measured memory_bytes: 78464
#[allow(unused_imports)]
use std::cmp::{max, min};
use std::collections::*;
use std::io::{stdin, Read};

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: tt),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, u1) => {
        $it.next().unwrap().parse::<usize>().unwrap() -1
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, n: usize, a: [usize; n]);
    let a: Vec<usize> = a;
    let mut b = BTreeMap::new();
    for &ai in a.iter() {
        *b.entry(ai).or_insert(0usize) += 1;
    }

    let mut ret = 0;
    let mx = *b.iter().rev().next().unwrap().0;
    while b.len() > 0 {
        let (&cur, count) = b.iter().next().unwrap();
        if *count == 1 {
            ret += 1;
        }
        b.remove(&cur);
        let mut c = cur * 2;
        while c <= mx {
            b.remove(&c);
            c += cur;
        }
    }
    println!("{}", ret);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 10904
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void output(string str,string str_c,int num)
{
  if(str == str_c)cout<<num<<endl;
  return;
}
//CODE
void solve(void)
{
  int A,B,C;
  cin>>A>>B>>C;
  int M = max(A,max(B,C));
  int MIN = min(A,min(B,C));
  if((A*B*C)%2 == 0)
  {
    cout<<0<<endl;
  }
  else
  {
    cout<< min(A*B,min(B*C,C*A))<<endl;
  }
  

  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60


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

	int N; cin >> N;
	int M = N - (N / 2);
	double ans = double(M) / double(N);
	cout << setprecision(15) << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env ruby
# require 'pry'

# dpテンプレ
# 最小化
# dp = Hash.new{ Float::INFINITY }
# dp[i] = [dp[i], dp[i-1] + hoge].min
# dp[0] = 0
# 最大化
# dp = Hash.new{ 0 }
# dp[i] = [dp[i], dp[i-1] + hoge].max
# dp[0] = 0

x = gets.split(' ').map(&:to_i)
puts x.index(0) + 1


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

const int INF = (1<<30)-1;

template<typename T>
T gcd(T a, T b)
{
	return b ? gcd(b, a%b) : a;
}

template<typename T>
T lcm(T a, T b)
{
	return a / gcd(a, b) * b;
}

//(a^e)%mod
template<typename T>
T power(T a, T e, T mod)
{
	if(e == 0)
	{
		return 1;
	}
	if(e % 2 != 0)
	{
		//a^e=a^(e-1)*a
		return (power(a, e - 1, mod) * a) % mod;
	}
	T res = power(a, e / 2, mod);
	//a^e=a^(e/2)*a^(e/2)
	return (res * res) % mod;
}

template<typename T>
class Tree
{
private:
public:
	T data;
	Tree* parent = NULL;
	std::vector<Tree*> children;
	void setData(T x)
	{
		data = x;
	}
	void setParent(Tree* t)
	{
		parent = t;
	}
	void addChild(Tree* t)
	{
		children.push_back(t);
	}
	Tree(){}
	~Tree(){}
};

template<typename T>
class Graph
{
public:
	T index;
	vector<T> edge;
	void setEdge(T t)
	{
		edge.push_back(t);
	}
	Graph(){}
	~Graph(){}
};

int prim(int size, int cost[101][101])
{
	const int indexed = 1;
	const int WHITE = 0;
	const int BLACK = 1;
	const int GRAY = 2;
	int colour[size + indexed], d[size + indexed], p[size + indexed];
	int u;
	for (int i = indexed; i < size + indexed; ++i)
	{
		colour[i] = WHITE;
		d[i] = INF;
	}
	d[indexed] = 0;
	p[indexed] = -1;

	priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> PQ;
	PQ.push(make_pair(0, indexed));

	while(!PQ.empty())
	{
		u = PQ.top().second;
		PQ.pop();
		colour[u] = BLACK;
		for (int i = indexed; i < size + indexed; ++i)
		{
			if(colour[i] != BLACK && cost[u][i] != INF)
			{
				if(cost[u][i] < d[i])
				{
					PQ.push(make_pair(cost[u][i], i));
					d[i] = cost[u][i];
					p[i] = u;
					colour[i] = GRAY;
				}
			}
		}
	}
	int sum = 0;
	for (int i = indexed; i < size + indexed; ++i)
	{
		if(p[i] != -1)
		{
			sum += cost[i][p[i]];
		}
		// cout << i << " " << p[i] << endl;
	}
	return sum;
}

int main()
{
	using namespace std;
	Graph<int> G[101];
	int costn[101][101];
	int n;
	cin >> n;
	for (int i = 1; i <= n; ++i)
	{
		for (int j = 1; j <= n; ++j)
		{
			int e;
			cin >> e;
			costn[i][j] = (e == -1 ? INF : e);
		}
	}
	cout << prim(n, costn) << endl;

	return 0;
}



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

int main () {
    int n;
    while (cin >> n, n) {
        vector<int> start_secs, end_secs;
        for (int i = 0; i < n; i++) {
            char c;
            int hh, mm, ss;
            cin >> hh >> c >> mm >> c >> ss;
            int sec = hh * 3600 + mm * 60 + ss;
            start_secs.push_back(sec);
            cin >> hh >> c >> mm >> c >> ss;
            sec = hh * 3600 + mm * 60 + ss;
            end_secs.push_back(sec);
        }
        sort(start_secs.begin(), start_secs.end());
        sort(end_secs.begin(), end_secs.end());

        int i = 0, j = 0, counter = 0, result = 0;
        while (i < n && j < n) {
            int start_sec = start_secs[i];
            int end_sec = end_secs[j];
            if (start_sec < end_sec) {
                counter++;
                result = max(result, counter);
                i++;
            } else {
                counter--;
                j++;
            }
        }
        cout << result << endl;
    }
}

Measured memory_bytes: 1340
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
using namespace std;

/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define fi first
#define se second

using Graph = vector<vector<int>>;

void dfs(Graph &G,vector<bool>&seen, vector<ll>&vec, ll v){
    seen[v]=true;
    for(auto next_v:G[v]){
        if(seen[next_v])continue;
        vec[next_v]+=vec[v];
        dfs(G,seen,vec,next_v);
    }
}

int main() {
    ll n,q;
    cin>>n>>q;
    Graph G(n);
    for(int i=0;i<n-1;i++){
        ll a,b;
        cin>>a>>b;
        G[a-1].push_back(b-1);
        G[b-1].push_back(a-1);
    }
    vector<pair<ll,ll>>px(q);
    for(int i=0;i<q;i++){
        cin>>px[i].fi>>px[i].se;
    }
    vector<ll>vec(n,0);
    for(int i=0;i<q;i++){
        vec[px[i].fi-1]+=px[i].se;
    }
    //  cout<<"--------------"<<endl;
    //  for(int i=0;i<vec.size();i++){
    //      cout<<vec.at(i)<<endl;
    //  }
    vector<bool>seen(n,false);
    dfs(G, seen, vec, 0);

    for(int i=0;i<n;i++){
        cout<<vec[i]<<" ";
    }
    cout<<endl;



    return 0;
}


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

int main()
{
    int K, N;
    cin >> K >> N;
    int A[N];
    for (int i = 0; i < N; i++) cin >> A[i];

    int maxDist = K - A[N - 1] + A[0];
    for (int i = 1; i < N; i++) {
        maxDist = max(maxDist, A[i] - A[i - 1]);
    }
    cout << K - maxDist << endl;
    return 0;
}

Measured memory_bytes: 4380
#include <stdio.h>

int main (void)
{
    long long N, A, B, P;
    int i;
    long long one = 0, two = 0, three = 0, ans;

    scanf("%lld", &N);
    scanf("%lld %lld", &A, &B);
    for (i = 0; i < N; i++) {
        scanf("%lld", &P);
        if (P <= A) one++;
        else if ((P > A) && (P <= B)) two++;
        else three++;
    }

    ans = (one < two) ? one : two;
    ans = (ans < three) ? ans : three;

    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(void){
  int N;
  cin>>N;
  int f(0);
  for(double a(0);a<=N/4;a++){
    for(double b(0);b<=N/7;b++){
      if(b==(N-4*a)/7)f++;
    }
  }
  if(f==0)cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long

using namespace std;


int main() {
    ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
    int a,b;
    cin>>a>>b;
    vector<int>vec(a);
    map<int,int>ma;
    set<int>se,se1;
    for(int i=0;i<a;i++){
        cin>>vec[i];
        se.insert(vec[i]);
    }
    se1=se;
    for(int i=0;i<a;i++){
        int r=vec[i];
        if(se.find(r)==se.end())
            continue;
        se.erase(r);
        if(se.empty())
            continue;
        int e=*se.rbegin();
        ma[e-r]++;
    }
    int m=0,r=0;
    for(auto it:ma){
        m=max(m,it.first);
    }
    for(int i=0;i<a;i++){
        int o=vec[i]+m;
        if(se1.find(o)!=se1.end()) {
            r++;
        }
        se1.erase(vec[i]);
    }
    cout<<r;
}

Measured memory_bytes: 9984
# mのとりうる範囲を考える 最小値はまあ2だろう 最大値はN-1になる（modなので）

# こんがらがったので小さい数で考える
# N = 65
# まずN-1は商1余り1を達成できる 64
# 商2の範囲 21 < x <= 32 （N//3 < x <= N//2)
# 32では余り1, 31では余り3になり、以降xを少なくしてもあまりが増えるだけなので達成できない
# 商3の範囲 16 < x <= 21
# 21では余り2, 20では余り5 達成できない
# 商4 13 <= x <16
# 16では余り1, 15では5 達成できない
# 商5の範囲 10 < x <= 13
# 13では余り0, 12では5 達成できる 64+12 = 76
# 商6の範囲 9 < x <= 10
# 10では余り5, 9は無理
# 商7はどうなる？ いちおう8 < x<= 9
# 9では余り2 達成できない
# 商8 7< x <= 8
# 8では余り1で達成できない
# 商9 6 < x <= 7だが、商>余りの最大値 になってしまい、コレ以上は無意味
# 答えは76

# N = 329
# で考える まずはN-1で 328
# 商2 109 < x <= 164
# 164では1 163では3 達成できない
# 商3 82 < x <= 109
# 109では2 108では5 達成できない
# 商4 65 < x <= 82
# 82では1 81では5 達成できない
# 商5 54 < x <= 65
# 65では4 64では9 達成できない
# 商6 47 < x <= 54
# 54では5 53では11 達成できない
# 商7 41 < x <= 47
# 47では0 46で7になり、達成できる 328+46 = 374
# 商8 36 < x <= 41
# 41では1 40では9 達成できない
# 商9 32 < x <= 36
# 36では5 35では14 達成できない
# 商10 29 < x <= 32
# 32では9 31では19 達成できない
# 商11 27 < x <= 29
# 29では10 28では21 達成できない
# 商12 25 < x <= 27
# 27では5 27では17 達成できない
# 商13 23 < x <= 25
# 25では4 25では17 達成できない
# 商14 21 < x <= 23
# 23では7 22では21 達成できない
# 商15 20 < x <= 21
# 21では14 達成できない
# 商16 19 < x <= 20
# 20では9 達成できない
# 商17 18 < x <= 19
# 19では6 達成できない
# 商18 17 < x <= 18
# 18では5 達成できない8
# これ以降は無意味
# 答えは374

# というのを愚直に実装してみる...
N = int(input())
if N <= 2:
    print(0)
    exit()
ans = N - 1
div = 2
limit = N // div
while div <= limit:
    tmp = limit
    # ここ明らかに無駄っぽい気がするんだよなー
    while True:
        if N % tmp > div or tmp <= N // (div + 1):
            break
        if N % tmp == div:
            ans += tmp
            break
        tmp -= 1
    div += 1
    limit = N // div
print(ans)

Measured memory_bytes: 9172
# https://atcoder.jp/contests/agc016/tasks/agc016_a

from collections import Counter
s = input()
c = Counter(s)
ans = float('inf')
for k, v in c.items():
    # if v < 2:
    #     continue
    t = [-1]
    for i in range(len(s)):
        if s[i] == k:
            t.append(i)
    t.append(len(s))
    temp = []
    for j in range(len(t) - 1):
       temp.append(t[j + 1] - t[j] - 1)
    ans = min(ans, max(temp))
print(ans)

Measured memory_bytes: 38512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define Would
#define you
#define please

int main() {


	int Q, A[100], B[100];
	cin >> Q;
	rep(i, Q) cin >> A[i] >> B[i];

	rep(i, Q) {
		int kotae = 2 * (min(A[i], B[i]) - 1);
		
		ll kaketa = 1ll * A[i] * B[i];
		ll root = pow(kaketa, 0.5);
		if (pow(kaketa, 0.5) - root == 0.0) root--;
		ll r1 = root;
		ll r2;
		if (r1 * (r1 + 1) < kaketa) r2 = r1 + 1;
		else r2 = r1;

		kotae += max(0ll, r1 - min(A[i], B[i]));
		kotae += max(0ll, r2 - min(A[i], B[i]));

		co(kotae);
	}
	Would you please return 0;

}

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

int main(){
    int L, R;
    cin >> L >> R;

    int a = 0;
    int b = 0;

    a = L % 2019;
    b = R % 2019;

    int ans = 2020;

    if(a == 0 || b == 0){
        cout  << 0 << endl;
    }else if(a >= b){
        cout << 0 << endl;
    }else if((L + 2019) <= R){
        cout << 0 << endl;
    }else{
        for(int i = a + 1; i <= b; i++){
            for(int j = a; j < i; j++){
                if(ans >= (i * j) % 2019){
                    ans = (i * j) % 2019;
                }
            }
        }

        cout << ans << endl;
    }

    /*if(L == 0){
        cout << 0 << endl;
    }else if(a == 0 || b == 0){
        cout << 0 << endl;
    }else{
        if((L + 2019) <= R){
                cout << 0 << endl;
        }else{
            if(a >= b){
                cout << 0 << endl;
            }else{
                if((L + 673) <= R){
                    cout << 0 << endl;
                }else{
                    for(int i = L + 1 ; i <= R; i++){
                        for(int j = L; j < i; j++){
                            if(ans >= ((i * j) % 2019)){
                                ans = (i * j) % 2019;
                            }
                        }
                    }

                    cout << ans << endl;
                }
        }
    }
    }*/

    /*else if(a == 0 || b == 0){
        if(a == 0){
            if(L + 2019 <= R){
                cout << 0 << endl;
            }else{
                cout << 1 << endl;
            }
        }else if(b == 0){
            if(L + 2019 <= R){
                cout << 0 << endl;
            }else{
                cout << a << endl;
             */
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
  string A, B;
  cin >> A >> B;
  int X = A.size();
  int Y = B.size();
  rep(i, Y) {
    cout << A.at(i) << B.at(i);
  }
  if(X > Y) {
    cout << A.at(X - 1);
  }
}

Measured memory_bytes: 3568
#include<iostream>
#include<algorithm>
#include<queue>
#include<string>
#include<vector>
using namespace std;
const int INF = 200000005;
int main()
{
	int n;
	cin >> n;
	if (n < 1000) {
		cout << "ABC"<< endl;
	}
	else {
		cout << "ABD" << endl;
	}
    return 0;
}



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

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

bool kisuu(ll num) {
	if (num % 2 == 1) return true;
	else return false;
}

int main() {
	string a, b, c;
	cin >> a >> b;
	c = a + b;
	double data = std::stoi(c);
	double ans = pow(data, 0.5);

	if (ceil(ans) != floor(ans)) {
		cout << "No";
	}
	else {
		cout << "Yes";
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
int main()
{
  using namespace std;
  string s;
  cin>>s;
  string tmp="\0";
  int i;
  rep(i,5){
    tmp+="hi";
    if(s.compare(tmp)==0){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;

int keta(int n){
  int c=0;
  while(n>=10){
    c+=n%10;
    n/=10;
  }
  c+=n;
  return c;
}

int main(){
  int n; cin>>n;
  int f=keta(n);
  if(n%f==0)
  cout<<"Yes"<<endl;
  else
  cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	const maxWord = (1 << 30)
	buf := []byte{}
	sc.Buffer(buf, maxWord)
	sc.Split(bufio.ScanWords)
}

func input() string {
	sc.Scan()
	return sc.Text()
}

type Tea struct {
	price int
	rate  int
	size  int
}

type ByRate []Tea

func (a ByRate) Len() int           { return len(a) }
func (a ByRate) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a ByRate) Less(i, j int) bool { return a[i].rate < a[j].rate }

func divmod(x, y int) (int, int) {
	return x / y, x % y
}

func main() {
	q, _ := strconv.Atoi(input())
	h, _ := strconv.Atoi(input())
	s, _ := strconv.Atoi(input())
	d, _ := strconv.Atoi(input())
	n, _ := strconv.Atoi(input())

	n *= 100
	qRate := q * 8
	hRate := h * 4
	sRate := s * 2
	dRate := d
	teas := []Tea{
		{q, qRate, 25},
		{h, hRate, 50},
		{s, sRate, 100},
		{d, dRate, 200},
	}
	sort.Sort(ByRate(teas))

	ans := 0
	for _, tea := range teas {
		num, rem := divmod(n, tea.size)
		ans += num * tea.price
		n = rem
		if n == 0 {
			break
		}
	}
	fmt.Println(ans)
}


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

vector<int> edges[2000];

int dfs(int i, int p, int lim, int d){
    int ans = (lim < d);
    for(int j : edges[i]) if(j != p) ans += dfs(j, i, lim, d+1);
    return ans;
}

int main(){
    int N, K;
    cin >> N >> K;
    for(int i=0; i<N-1; i++){
        int a, b;
        cin >> a >> b;
        edges[a-1].push_back(b-1);
        edges[b-1].push_back(a-1);
    }
    int ans = N;
    if(K%2){
        for(int i=0; i<N; i++) for(int j : edges[i]){
            ans = min(ans, dfs(i, j, K/2, 0) + dfs(j, i, K/2, 0));
        }
    }else{
        for(int i=0; i<N; i++) ans = min(ans, dfs(i, -1, K/2, 0));
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
// ------------------------------------
// Date:2018/ 2/18
// Problem:ABC 086 Traveling c.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

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

int main()
{
  int N;
  cin >> N;
  vector< int > t(N);
  vector< int > x(N);
  vector< int > y(N);
  REP(i, N) {
    cin >> t[i] >> x[i] >> y[i];
  }
  int dx, dy, dt;
  bool ok = true;
  REP(i, N) {
    if (i == 0) {
      dx = x[0];
      dy = y[0];
      dt = t[0];
    } else {
      dx = abs(dx - x[i]);
      dy = abs(dy - y[i]);
      dt = abs(dt - t[i]);
    }
    if ((dx + dy) %2 != dt % 2 || dx + dy > dt) {
      ok = false;
    }
  }
  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}



Measured memory_bytes: 1408
/* AtCoder Beginner Contest abc137
 * Problem A
 * Au: SJoshua
 */
#include <cstdio>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>

using namespace std;

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


Measured memory_bytes: 256
import math
def is_prime(n):
    if n == 1: return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True
def near2017(n):
    if is_prime(n):
        return is_prime((n+1)//2)
    else:
        return False
#############################################################
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')

N = 100000
prime = [0]*100001
cur = 0
ans = []
for i in range(1,N+1):
    if near2017(i):
        cur +=1
        prime[i] = cur
    else:
        prime[i] = prime[i-1]
#print(prime[N])
cur = int(0)
Q = I()
for i in range(Q):
    l, r = LI()
    cur = prime[r] - prime[l-1]
    ans.append(cur)

for v in ans:
    print(v)


Measured memory_bytes: 56796
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(int argc, char*argv[])
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n, k;
	cin >>n>>k;
	int jump[n];
	for (int i =0; i< n ; i++)
		cin >> jump[i];
	int dp [n][k+1];
	
	
	for(int i = 1; i <= min(n, k); ++i)
		dp[0] [i] = abs(jump[0] - jump[i]);
		
	for (int i = 1 ; i< n-1; ++i)
	{
		for (int j= 1 ; j < k; ++j)
			dp[i][j] = min( (dp[i-1][1] + abs(jump[i] - jump[i+j])), dp[i-1][j+1]);
		if(i+k < n)
			dp[i][k] = dp[i-1][1]+ abs(jump[i] - jump[i+k]);
	}
	cout << dp[n-2][1]<<endl;
}



Measured memory_bytes: 40064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define in insert
#define mp make_pair
#define F first
#define pb push_back
#define speed ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test ll t; cin>>t; while(t--)
ll exp(ll x,ll y,ll p){ ll res=1; while(y) {if(y%2) res=(res*x%p)%p; x=(x*x)%p; y/=2; } return res;}
ll exp(ll x,ll y){ ll res=1; while(y) {if(y%2) res=(res*x); x=(x*x); y/=2; } return res;}

int main(){
    string s; cin>>s;
    string s5=s;
    ll n=s.length();
    string s1=s.substr(0,n/2);
    string s2= s.substr(n/2+1,n/2);
   // cerr<<s1<<" "<<s2<<endl;
    string s3=s1;
    string s4=s2;
    reverse(s3.begin(),s3.end());
    reverse(s4.begin(),s4.end());
    reverse(s5.begin(),s5.end());
    if(s1==s3 && s2==s4 && s==s5)
        cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(void) {
  int N;
  int K;

  int decimal;
  int count;

  scanf("%d %d", &N, &K);

  decimal = N;
  count = 0;
  while (decimal > 0) {
    decimal /= K;
    count++;
  }

  printf("%d\n", count);

  return (0);
}


Measured memory_bytes: 128
def solve():
	from collections import deque
	n,*l=map(int,open(0).read().split())
	con=[[] for _ in range(n)]
	dist=[None]*n
	dist[0]=0
	for a,b,c in zip(*[iter(l)]*3):
		con[a-1].append((b-1,c%2))
		con[b-1].append((a-1,c%2))
 
	stk=deque([0])
	while stk:
		cur=stk.pop()
		for nxt,d in con[cur]:
			if dist[nxt]==None:
				stk.append(nxt)
				dist[nxt]=(dist[cur]+d)%2

	print(*dist,sep="\n")

if __name__=="__main__":
	solve()

Measured memory_bytes: 49396
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

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

#define DEBUG
#ifndef DEBUG
#define endl "\n"
#endif

const double PI = acos(-1);
typedef long long ll;
#define fori(n) for(ll i=0; i<(n); i++)

#define cins(s) string s; cin>>s;
#define cini(i) int i; cin>>i;
#define cinll(l) ll l; cin>>l;
#define cind(d) double d; cin>>d;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinall(a, n) vll a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a, n) vd a(n); fori(n) { cin>>a[i]; }

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;
typedef vector<ll> vll;

void solve() {
	cini(n);
	cini(k);
	vi rsp(3);
	cin >> rsp[0] >> rsp[1] >> rsp[2];
	vi vt(n);
	cins(t);
	for (char c : t) {
		if (c == 'r')
			vt.push_back(0);
		else if (c == 's')
			vt.push_back(1);
		else if (c == 'p')
			vt.push_back(2);
		else
			assert(false);
	}

	vvi dp(n, vi(3));	// dp[i][j] max score after round i when having played j in that round

	vi dpP(n);	// dpP[i]=point got in round i
	vi dpH(n);	// dpH[i]=hand we got point throug

#define R 0
#define S 1
#define P 2

	for (int i = 0; i < n; i++) {
		if (t[i] == 'r')
			dpH[i] = P;
		else if (t[i] == 's')
			dpH[i] = R;
		else if (t[i] == 'p')
			dpH[i] = S;
		else
			assert(false);
		dpP[i] = rsp[dpH[i]];

		if (i >= k && dpH[i - k] == dpH[i]) {
			dpP[i] = 0;
			dpH[i] = -1;
		}
	}
	ll ans = 0;
	for (int i = 0; i < n; i++)
		ans += dpP[i];
	cout << ans << endl;
}

int main() {
	cin.tie(nullptr);
	std::ios::sync_with_stdio(false);
	solve();
}



Measured memory_bytes: 7496
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, a, ans;
  cin >> N; 
  
  if ( N <= 1000 ) {
    ans = 1000 - N;
  } else if ( N % 1000 == 0 ) {
    ans = 0;
  } else {
  	a = N % 1000;
    ans = 1000 - a;
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3620