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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

string solve(string tmp, string& s){
  int n = 0;
  if(tmp == "res"){
    n = 3;
  }
  else if(tmp == "esa"){
    n = 2;
  }
  else if(tmp == "rem"){
    n = 4;
  }
  else if(tmp == "mae"){
    n = 2;
  }
  string ans = "";
  for(int i = 0; i < n; ++i){
    ans += s.back();
    s.pop_back();
  }
  return ans;
}

int main() {
  string s;
  cin >> s;
  while(!s.empty()){
    string tmp = "";
    for(int i = 0; i < 3; ++i){
      tmp += s.back();
      s.pop_back();
    }
    tmp += solve(tmp, s);
    if(tmp != "resare" && tmp != "esare" && tmp != "remaerd" && tmp != "maerd"){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES cout<<"YES"<<'\n'
#define NO cout<<"NO"<<'\n'
#define Yes cout<<"Yes"<<'\n'
#define No cout<<"No"<<'\n'
#define yes cout<<"yes"<<'\n'
#define no cout<<"no"<<'\n'
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << '\n'
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n >>= 1; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    int h,w; cin >> h >> w;
    string s[h]; REP(i,h) cin >> s[i];
    REP(i,h)REP(j,w) if(s[i][j]=='.'){
        int c = 0;
        FOR(dx,-1,2)FOR(dy,-1,2){
            if(dx==0 && dy==0) continue;
            int xx = j + dx;
            int yy = i + dy;
            if (0<=xx && xx<w && 0<=yy && yy<h) if(s[yy][xx] == '#') c++;
        }
        s[i][j] = char('0'+c);
    }
    REP(i,h) out(s[i]);

    return 0;
}

Measured memory_bytes: 256
class Main
{
	public static void main( String[] args )
	{
		java.util.Scanner sc = new java.util.Scanner( System.in );
		
		int n = sc.nextInt();
		
		double money = 100000;
		
		for( int i = 0 ; i < n ; i++ ){
			money *= ( 1.05 );
			money += 999;
			money =  (int)(money/1000)*1000;
		}
		System.out.println( (int)money );
	}
}

Measured memory_bytes: 25860
#######################################
import numpy as np
import math
import copy
import re
import sys
#sys.exit(0)

inf = float("inf")
prime = 1

def check_print(check_flag, text, end="\n"):
  if check_flag:
    print(text, end=end)

def c2i(x):
    if str.isdecimal(x):
        return int(x)
    else:
        return x

def cout(*args):
  arglist = []
  for arg in args:
    if hasattr(arg, "__iter__"):
      arglist.extend(arg)
    else:
      arglist.append(arg)
      
  arglist = list(map(str, arglist))
  print(" ".join(arglist))
  
def count2(num):
  count=0
  while num%2==0:
    num/=2
    count+=1
  return count

def ketasum(num):
  nums = [int(s) for s in str(num)]
  return sum(nums)

#math
def gcd(a, b): #最大公約数
  while b:
    a, b = b, a % b
  return a

def lcm(a, b): #最小公倍数
  return a * b // gcd (a, b)

def gcd3(lis): #最大公約数(3over)
  ans = lis[0]
  for li in lis:
    ans = gcd(ans,li)

def lcm3(lis): #最小公倍数(3over)
  ans = lis[0]
  for li in lis:
    ans = lcm(ans,li)

def divisor(n): #nの約数を全て求める
  i = 1
  table = []
  while i * i <= n:
    if n%i == 0:
      table.append(i)
      table.append(n//i)
    i += 1
  table = list(set(table))
  return table

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

def is_prime(n):
  for i in range(2, n + 1):
    if i * i > n:
      break
    if n % i == 0:
      return False
  return n != 1

#input stock
"""
n = int(input())

#list
a = map(int, input().split())
a,b = map(int, input().split())

d=[]
for i in range(n):
  d[i]=int(input())

#2dim-list
a = [list(map(int, input().split())) for i in range(n)]

s = input()
ss =  [int(si) for si in s]
"""

#processing stock
"""
a = sorted(a)
a = sorted(a, reverse=True)

"""

#regex
"""
pattern = ""
result = re.search(pattern, s)

result = re.fullmatch(pattern, s)

result = re.finditer(pattern, s)
for res in result:
    print res.group()   # 1回目: ca      2回目: ca   
    print res.start()   # 1回目: 0       2回目: 6      
    print res.end()     # 1回目: 2       2回目: 8      
    print res.span()    # 1回目: (0, 2)  2回目: (6, 8)
"""

#######################################
r = int(input())

print(3*r**2)





Measured memory_bytes: 12212
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 2000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

string s;
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> s;
    int a = -1, b = -1;
    rep(i, 0, s.size()) {
        if (i+1 < s.size() && s[i] == s[i+1]) {
            a = i+1, b = i+2;
            break;
        } else if (i+2 < s.size() && s[i] == s[i+2]) {
            a = i+1, b = i+3;
            break;
        }
    }
    cout << a << " " << b << endl;
    return 0;
}


Measured memory_bytes: 512
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 1000000000000000007LL;
constexpr int inf = 1000000007;

int main() {
    int n, l; cin >> n >> l;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
    }

    for (int i = 1; i <= n - 1; ++i) {
        if (a[i] + a[i + 1] >= l) {
            cout << "Possible" << endl;
            for (int j = 1; j <= i - 1; ++j) {
                cout << j << endl;
            }
            for (int j = n - 1; j > i; --j) {
                cout << j << endl;
            }
            cout << i << endl;
            return 0;
        }
    }

    cout << "Impossible" << endl;
    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

#define DEBUG

#ifdef DEBUG
#define var_dump(...) fprintf(stdout, __VA_ARGS__)
#define dump(a) cout << a << "\n";
#else
#define var_dump(...) 42
#define dump(a) 42
#endif

// https://beta.atcoder.jp/contests/abc051/tasks/abc051_b

int main() {

    int K, S;
    cin >> K >> S;

    int cnt = 0;
    REP(x, K+1) {
        REP(y, K+1) {
            int z = S - (x + y);
            if (z >= 0 && z <= K) {
                cnt++;
            }
        }
    }

    cout << cnt << "\n";

    return 0;
}


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

namespace AtCoder
{
    class Program
    {
        private const int MODULO = 1000000007;
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static long Solve(int N, int P, int[] A)
        {
            var dp = new long[] { 1, 0 };
            for (int i = 0; i < N; ++i)
            {
                if (A[i] % 2 == 0)
                {
                    dp[0] *= 2;
                    dp[1] *= 2;
                }
                else
                {
                    long sum = dp.Sum();
                    dp[0] = sum;
                    dp[1] = sum;
                }
            }
            return dp[P];
        }
        static void Main(string[] args)
        {
            var V = ReadInts();
            var A = ReadInts();
            Console.WriteLine(Solve(V[0], V[1], A));
        }
    }
}


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

int main(){
	int n, a, b;
	cin >> n >> a >> b;

	if (abs(b - a) % 2 == 0) {
		cout << "Alice" << endl;
	}
	else {
		cout << "Borys" << endl;
	}


	return 0;
}

Measured memory_bytes: 256
# coding: utf-8
for i in range(6):
    inp = input()
    if i == 0: minn = int(inp)
    elif i == 4: maxn = int(inp)
    elif i == 5: k = int(inp)
    
if maxn - minn <= k:
    print('Yay!')
else:
    print(':(')

Measured memory_bytes: 3060
#include<stdio.h>

int main()
{
    int a,b,c,t;
    scanf("%d%d%d",&a,&b,&c);
    if((b+c)>a){
        t=c-(a-b);
        printf("%d\n",t);
    }
    else{
        printf("0\n");
    }
}


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

#define boost ios::sync_with_stdio(0); cin.tie(0);
#define int long long
const int N = 2e5 + 10;
const int MOD = 1e9 + 7;

int fact[N] , inv[N];
int n , w , a , b;

int fastpow(int a , int b){
	int ans = 1;
	a %= MOD;
	while(b){
		if(b&1)
			ans = (ans*a)%MOD;
		b >>= 1;
		a = (a*a)%MOD;
	}
	return ans;
}

void pre(){
	fact[0] = 1;
	for(int i = 1 ; i < N ; ++i){
		fact[i] = (fact[i-1]*i)%MOD;
	}
	inv[N-1] = fastpow(fact[N-1],MOD-2);
	for(int i = N-2 ; i >= 0 ; --i){
		inv[i] = ((i+1)*inv[i+1])%MOD;
	}
}

int ways(int n , int r){
	return (fact[n+r-2]*(inv[r-1]%MOD * inv[n-1]%MOD)%MOD)%MOD;
}

int32_t main(){
	// boost;
	// cin >> n >> w >> a >> b;
	scanf("%lld%lld%lld%lld",&n,&w,&a,&b);
	pre();

	int out = 0;	
	for(int i = b+1 ; i <= w ; ++i){

		// Number of ways till (1,1) to (n-a , i) * Number of ways the remaining till last ( (a,w-i+1 ))
		out += ((ways(n-a,i)%MOD)*ways(a,w-i+1)%MOD)%MOD;
		out %= MOD;
	}

	// cout << out;
	printf("%lld\n", out);
	return 0;
}// Read my code it is awesome.

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

namespace arc068_b
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Dictionary<int, int> dic = new Dictionary<int, int>();
            for (int i = 0; i < n; i++)
            {
                if (!dic.ContainsKey(x[i])) dic[x[i]] = 0;
                dic[x[i]]++;
            }
            int ret = dic.Count();
            int even = ret;
            foreach (var item in dic)
            {
                even -= item.Value % 2;
            }
            Console.WriteLine(ret - even % 2);
        }
    }
}

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

#define li long long int
#define rep(i, to) for (li i = 0; i < ((li)(to)); i++)
#define MOD 1000000007
typedef pair<li, li> PI;

int main(void)
{
	li n;
	cin >> n;
	rep(i, 9) {
		rep(j, 9) {
			if ((i + 1) * (j + 1) == n) {
				puts("Yes");
				return 0;
			}
		}
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <unordered_map>
#include <cmath>
#include <algorithm>

typedef long long ll;
typedef long double ld;

using namespace std;
int main()
{
  int n;
  string s, s_abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
  cin >> n >> s;
  for (int i = 0; i < s.length(); ++i)
  {
    cout << s_abc[s_abc.find(s[i]) + n];
  }
}


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


vector<int> tree[100001];
vector<int> dp(100001,-1); 

int dfs(int node)
{
    if(dp[node] != -1) return dp[node];

    int depth = 1;

    for(int child: tree[node])
    {
        depth = max(depth,1+dfs(child));
    }

    return dp[node] = depth; 

}
void solve()
{
    
  int n,m; cin >> n >> m ; 
  for(int i = 0 ; i < m  ; i ++)
  {
    int a,b; cin >> a >> b;
    a--;b--; 
    tree[a].push_back(b); 
  }

  int max_ans = 0;

  for(int i = 0 ; i < n ; i ++)
  {
    max_ans = max(max_ans,dfs(i));
  }

  cout << max_ans-1 << endl; 
}

int main()
{

    solve(); 
    return 0;
}




Measured memory_bytes: 10892
import math
all ,blue = map(int,input().split())
red = all - blue

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


for i in range(1,blue+1):
    if (red+1) < i:
        print('0')
    else:
        print((combinations_count(blue-1,i-1)*combinations_count(red+1,i))%(10**9+7))





Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <map>
using namespace std;
int main(void){
    int n, mx = 0;
    cin >> n;
    map<string, int> p;
    for(int i=0;i<n;i++){
        string s;
        cin >> s;
        int v = ++p[s];
        if(mx < v) mx = v;
    }
    for(auto x : p){
        if(x.second == mx) cout << x.first << endl;
    }
}


Measured memory_bytes: 25216
// AC

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

#define INF 100001

int main()
{
  // INPUT
  int n; cin >> n;
  int k; cin >> k;
  int arr[n];
  for(int i=0;  i<n; i++) cin >> arr[i];

  // INIT
  int dp[n]={};

  // Base case already done: dp[n-1]=0;


  for(int i=n-2;i>=0;i--)
  {
    int ans[k];
    // For every case: (i+1...i+k)
    for(int j=1; j<=k; j++)
    {
      // ans[j-1] because ans index is (0...j-1)
      if(i+j<n) ans[j-1]= dp[i+j] + abs(arr[i]-arr[i+j]);
      else ans[j-1]=INF;
    }
    dp[i]=*min_element(ans,ans+k);
  }

  // OUTPUT
  cout << dp[0] << endl;
}


Measured memory_bytes: 4408
#include<stdio.h>

int main(){
  
  int i,j,k,n,u,v;
  
  scanf("%d",&n);
  int Adj[n][n];
  
  for(i=0;i<=n-1;i++){
    for(j=0;j<=n-1;j++){
      Adj[i][j]=0;
    }
  }
  
  for(i=0;i<=n-1;i++){
    scanf("%d",&u);
    scanf("%d",&k);
    
    for(j=0;j<=k-1;j++){
      scanf("%d",&v);
      Adj[u-1][v-1]=1;
    }
  }
  
  for(i=0;i<=n-1;i++){
    for(j=0;j<n-1;j++){
      printf("%d",Adj[i][j]);
      if(j<n) printf(" ");
    }
    printf("%d",Adj[i][j]);
    printf("\n");
  }
  
  return 0;
  
}

Measured memory_bytes: 636
// abc072_b
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(int argc, char *argv[])
{
  string s;
  cin>>s;
  rep(i,s.size()){
    if (i%2==0) cout<<s[i];
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 512
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int N=20005;
int n,i,j,a[N],p[N],l,b[N],ans[N],g,G,cnt;
bool v[N];
int Abs(int a)
{
	return a>0?a:-a;
}
int gcd(int a,int b)
{
	if(!b)
		return a;
	return gcd(b,a%b);
}
int main()
{
	scanf("%d",&n);
	for(i=n;i>=0;--i)
		scanf("%d",a+i);
	for(i=2;i<=n;++i)
	{
		if(!v[i])
			p[++l]=i;
		for(j=1;j<=l&&p[j]*i<=n;++j)
		{
			v[p[j]*i]=true;
			if(i%p[j]==0)
				break;
		}
	}
	G=Abs(a[0]);
	for(i=1;i<=n;++i)
		G=gcd(G,Abs(a[i]));
	g=G;
	for(i=2;i*i<=g;++i)
		if(g%i==0)
		{
			ans[++cnt]=i;
			while(g%i==0)
				g/=i;
		}
	if(g>1)
		ans[++cnt]=g;
	for(i=1;i<=l;++i)
	{
		for(j=0;j<=n;++j)
			b[j]=(a[j]%p[i]+p[i])%p[i];
		for(j=n;j-p[i]+1>=1;--j)
		{
			b[j-p[i]+1]=(b[j-p[i]+1]+b[j])%p[i];
			b[j]=0;
		}
		for(;j>=0;--j)
			if(b[j]!=0)
				break;
		if(j<0&&G%p[i]!=0)
			ans[++cnt]=p[i];
	}
	sort(ans+1,ans+1+cnt);
	for(i=1;i<=cnt;++i)
		printf("%d\n",ans[i]);
	return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define MP make_pair

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n;
  scanf("%d", &n);

  int ans = 0, tmp = n;
  while(tmp > 0){
    ans += tmp % 10;
    tmp /= 10;
  }

  if(n % ans == 0){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int n,a;
	scanf("%d",&n);
	a=n%10;
	if(a==2||a==4||a==5||a==7||a==9)printf("hon\n");
	else if(a==0||a==1||a==6||a==8)printf("pon\n");
	else if(a==3)printf("bon\n");
	return 0;
}

Measured memory_bytes: 3164
#include <stdio.h>

int main(void){
  int r,c,i,j;
  static int s[101][101];

  scanf("%d%d",&r,&c);

  for(i=0;i<=r;i++){
    for(j=0;j<c;j++){
      scanf("%d", &s[i][j]);
      printf("%d ", s[i][j]);
      s[i][c] += s[i][j];
      s[r][j] += s[i][j];
    }
    printf("%d\n",s[i][c]);
  }

  return 0;
}



Measured memory_bytes: 2132
def examC():
    N = I()
    A = LI(); B = LI(); C = LI()
    A.sort(); B.sort(); C.sort()
    ans = 0
    for i in range(N):
        ans += bisect.bisect_left(A, B[i]) * (N - bisect.bisect_right(C, B[i]))
    print(ans)


import sys,copy,bisect,itertools
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()


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

int main() {
    string N;
    cin >> N;
    
    if(N.find('7') != string::npos) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
long long int dp[102][100005];
long long int N,W, w[100005],v[100005];
long long int ks(int rem_wt, int n)
{
    if(rem_wt <= 0||n==0)
        return 0 ;
    if(dp[n][rem_wt]!=-1)
        return dp[n][rem_wt];
    if (rem_wt - w[n]>=0)
    {
        return dp[n][rem_wt] = max(ks(rem_wt,n-1),v[n]+ks(rem_wt-w[n],n-1));
    }
    else return dp[n-1][rem_wt] = ks(rem_wt,n-1);
}

int main()
{
    cin >> N>>W ;
    for(int i = 0;i<=N;++i)
    {
        fill(dp[i],dp[i]+W+1,-1);
    }
    for(int i = 1 ; i<=N ;++i)
    {
        scanf("%d%d",&w[i],&v[i]);
    }
    cout<<ks(W,N);

}


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

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;

typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -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()
{
    int h, w;
    cin >> h >> w;
    char grid[h][w];

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> grid[i][j];
        }
    }
    
    vector < vector <int>> dist(h, vector<int>(w, -1));
    dist[0][0] = 0;

    int prev_x[h][w], prev_y[h][w];
    prev_x[0][0] = prev_y[0][0] = -1;

    queue<Pii> que;
    que.push(make_pair(0,0));
    
    while (!que.empty()) {
        Pii now = que.front();
        que.pop();

        int x = now.first;
        int y = now.second;
        //cout << x << " " << y << endl;
        for (int i = 0; i < 4; i++) {
            int n_x = x + dx[i];
            int n_y = y + dy[i];
            if (n_x < 0 or n_x >= h or n_y < 0 or n_y >= w) continue;
            if (grid[n_x][n_y] == '#') continue;
            if (dist[n_x][n_y] == -1) {
                que.push(make_pair(n_x, n_y));
                dist[n_x][n_y] = dist[x][y] + 1;
                prev_x[n_x][n_y] = x;
                prev_y[n_x][n_y] = y;
            }
        }
    }
    
    if (dist[h-1][w-1] == -1) {
        cout << -1 << endl;
        return 0;
    }

    int x = h-1, y = w-1;

    while (x != -1 and y != -1) {
        grid[x][y] = 'x';
        int tmp_x = prev_x[x][y];
        int tmp_y = prev_y[x][y];
        x = tmp_x;
        y = tmp_y;
        //cout <<x << " " << y << endl;
    }
    //cout << x << y << endl;
    int ans = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            //cout << "yes"<< endl;
            if (grid[i][j] == '.') ans++;
        }
    }
    cout << ans << endl;
    
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <thread>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)

using namespace std;

int main()
{
	int x, y, z, k; cin >> x >> y >> z >> k;

	vector<uint64_t> as(x);
	vector<uint64_t> bs(y);
	vector<uint64_t> cs(z);
	for (auto &a : as) {
		cin >> a;
	}
	for (auto &b : bs) {
		cin >> b;
	}
	for (auto &c : cs) {
		cin >> c;
	}

	vector<uint64_t> abs(x * y);
	{
		int pos = 0;
		FOR_LT(a, 0, x) {
			FOR_LT(b, 0, y) {
				abs[pos] = as[a] + bs[b];
				pos++;
			}
		}
	}
	sort(abs.begin(), abs.end());
	int ab_k = min(k, x * y);
	
	vector<uint64_t> ab_us(ab_k);
	copy(abs.begin() + (x * y - ab_k), abs.end(), ab_us.begin());

	vector<uint64_t> lasts(ab_k * z);
	{
		int pos = 0;
		FOR_LT(ab, 0, ab_k) {
			FOR_LT(c, 0, z) {
				lasts[pos] = ab_us[ab] + cs[c];
				pos++;
			}
		}
	}
	sort(lasts.begin(), lasts.end());

	int count = ab_k * z;
	FOR_LT(i, 0, k) {
		cout << lasts[count - 1 - i] << endl;
	}


	return 0;
}

Measured memory_bytes: 31616
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N, M;
    cin >> N >> M;
    int a[N+1];
    int dp[N+1];
    for(int i = 0;i < N+1;++i){
        a[i] = 1;
    }
    for(int i = 0;i < M;++i){
        int m;
        cin >> m;
        a[m] = 0;
    }
    dp[0] = 1;
    for(int i = 1;i < N+1;++i){
        if(i == 1){
            dp[i] = (a[i] * dp[i-1]) % 1000000007;
        }else{
            dp[i] = (a[i] * (dp[i-1] + dp[i-2])) % 1000000007;
        }
    }
    cout << dp[N] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
    cin>>arr[i];

   int dp[n+1]={};
   dp[1]=abs(arr[1]-arr[0]);
   for(int i=2;i<n;i++)
   {
       dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
   }
   cout<<dp[n-1]<<endl;
    return 0;
}


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

using namespace std;

typedef long long ll;
ll mod = 1e9 + 7;
ll power(ll y, ll x) {
    if(x == 0) return 1;
    ll res = 1;
    while(x) {
        if(x&1) res = (res*y)%mod;

        x = x>>1;
        y = (y*y)%mod;
    }
    return res%mod;
}

void solve() {
	
}

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

    ll n;
    cin >> n;

    ll res = 1;
    if(n < 2) cout << 0 << endl;
    else {
        // res = (power(10,n) + power(8,n))%mod;
        // res = res - (2*power(9,n));
        res = (power(10,n)-power(9,n))%mod;
        ll res1 = (power(8,n)-power(9,n))%mod;
        res = (res+res1)%mod;
        res = (res + mod)%mod;
        cout << res << endl;
    }
    // res = (res * n)%mod;
    // res = (res * (n-1))%mod;
    // res = (res * power(10,n-2))%mod;
    // cout << res << endl;
    

    return 0;
}

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


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



int main(void){
    int N;
    cin >> N;
    unordered_set<int> A(N);
    rep(i, N){
        int m;
        cin >> m; 
        A.insert(m);
    }
    
    int cnt = 0;
    int Q;
    cin >> Q;
    rep(i, Q){
        int m;
        cin >> m;
        cnt += A.count(m);
    }
    
    cout << cnt << endl;
    
    return 0;
}


Measured memory_bytes: 3116
import java.util.*;
public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int answer = 0;
      
      for(int i = 1; i <= n ; i++){
        answer += i;
      }      
      System.out.println(answer);
	}
}

Measured memory_bytes: 21076
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("trapv")
#pragma GCC target("sse4")

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

#define deb(x) cout << #x << " is " << x << "\n"
#define int long long
#define mod 1000000007
#define PI acos(-1)
// void swap(int *a, int *b)
// {
//     int t = *a;
//     *a = *b;
//     *b = t;
// }

int32_t main()
{
    double n, x, t;
    cin >> n >> x >> t;
    if( n <= x)
    cout<<t;
    else if( n > x)
    {
       int time = t * ceil(n/x);
       //cout<<ceil(n/x);
       cout<<time;
    }
    
    

    return 0;
}

Measured memory_bytes: 3776
#include <stdio.h>

int main(){
  int a[100];
  int n,i,j,count,flag,alt;

  flag=1;
  count=0;

  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&a[i]);
  
  while(flag){
    flag=0;
    for(i=n-1;i>0;i--)
      if(a[i]<a[i-1]){
	alt=a[i];
	a[i]=a[i-1];
	a[i-1]=alt;
	count++;
	flag=1;
      }
  }

  for(i=0;i<n-1;i++)printf("%d ",a[i]);
  printf("%d\n%d\n",a[i],count);

  return 0;
}
	

  

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

#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> P;
typedef map<int,int> mp;

const int MOD = 1e9 + 7;


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

    ll n, k;
    cin >> n >> k;
    vi a(n);
    rep(i, n){
        cin >> a[i];
    }

    ll ans = 0, cnt = 0;
    rep(i, n-1){
        rept(j, i+1, n){
            if(a[i] > a[j]){
                cnt ++;
            }
        }
    }
//    cout << cnt << endl;
    ans = cnt * k % MOD;

    cnt = 0;
    rep(i, n){
        rep(j, n){
            if(a[i] < a[j]){
                cnt++;
            }
        }
    }

//    cout << cnt << endl;
    ll x = (k * (k-1) / 2) % MOD;
    ans = (ans + cnt * x) % MOD;

    cout << ans << endl;


    return 0;
}



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

int main(void)
{
    int n,k, ans = 0;
    cin >> n>>k;

    vector<int> p(n);

    rep(i, n)
    {
        cin >> p.at(i);
    }

    sort(p.begin(), p.end());

    rep(i, k)
    {
        ans+=p.at(i);
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll linf = 1e18;
const db EPS = 1e-7;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

int h1, m1, h2, m2, k;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int mn = h1 * 60 + m1;
    int mx = h2 * 60 + m2;
    cout << mx - mn - k << endl;
    return 0;
}

Measured memory_bytes: 3648
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 30;
// clang-format on

ll A, B, K;
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> A >> B >> K;

  ll left = max(K - A, (ll)0);
  A = max(A - K, (ll)0);
  B = max(B - left, (ll)0);

  cout << A << " " << B << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  string s;
  cin >> s;
  if(s[2]==s[3] && s[4]==s[5]) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
    

}


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

int main() {
    int N; cin >> N;
    long long x; cin >> x;
    vector<long long> a(N);
    for (int i = 0; i < N; ++i) cin >> a[i];
    sort(a.begin(), a.end());
    int res = 0;
    for (int i = 0; i < N; ++i) {
        if (x >= a[i]) ++res, x -= a[i];
        else break;
    }
    if (res == N && x) --res;
    cout << res << endl;
}


Measured memory_bytes: 256
let n = Scanf.sscanf (read_line ()) "%d" @@ fun n -> n

let rec divisors acc i =
  if i * i > n then acc
  else if i * i = n then i :: acc
  else if n mod i = 0 then divisors (i :: (n / i) :: acc) (i + 1)
  else divisors acc (i + 1)
let divisors = divisors [] 1

let like i = i <> 0 && (n / i) = n mod i

let () = divisors
  |> List.map ((+) (-1))
  |> List.filter like
  |> List.fold_left (+) 0
  |> Printf.printf "%d\n"

Measured memory_bytes: 4404
import java.util.*;


public class Main {

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

        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();

        if (A == B) {
            if (B == C) {
                System.out.println("No");
            } else {
                System.out.println("Yes");
            }
        } else if (B == C) {
            if (A == B) {
                System.out.println("No");
            } else {
                System.out.println("Yes");
            }
        } else if (A == C) {
            if (B == C) {
                System.out.println("No");
            } else {
                System.out.println("Yes");
            }
        } else {
            System.out.println("No");
        }

    }
}








Measured memory_bytes: 23892
n=int(input())
a_list=[int(s) for s in input().split()]
b_list=[int(s) for s in input().split()]

total=0
for i,b in enumerate(b_list):
    a1=a_list[i]
    
    enemy=min(a1,b)
    if a1>=0 and b>0:
        b=b-enemy
        total+=enemy
    
    if b<=0:
        continue
    
    a2=a_list[i+1]
    enemy=min(a2,b)
    total+=enemy
    a_list[i+1]-=enemy
print(total)

Measured memory_bytes: 18468
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pii pair<int,int>
#define vi  vector<int>
#define vii vector<pair<int,int>>
#define vll vector<lli>
#define pb  push_back
#define mp  make_pair
#define ss  second
#define ff  first
#define all(x) x.begin(),x.end()
const lli mod = 1000000007;

lli p2(lli n){lli ans=0;while(n>=1){n=n/2;ans++;}return ans;}
lli b_ex(lli n,lli a){lli res=1;while(n){if(n%2==1)res*=a;n>>=1;a=a*a;}return res;}
lli ncr(lli n,lli k){lli ans=1;if(k>n-k)k=n-k;for(lli i=1;i<=k;i++){ans*=(n-i+1),ans=ans/i;}return ans;}
lli add(lli a,lli b){return(a+b)%mod;}
lli mul(lli a,lli b){return (a*b)%mod;}
lli power(lli a , lli n){lli ans = 1;while(n){if(n % 2)ans = (ans * a) % mod;n /= 2;a = (a * a) % mod;}return ans;}
lli lcm(lli a,lli b)
{
    lli ans=(a*b)/(__gcd(a,b));
    return ans;
}
///------------------ALWAYS lli-----TEMP TSF99--------------------------------------------------------------------------------------///
const int inf=1e9+7;
void solve()
{
    int n;cin>>n;
    vector<int>order(n),fuel(n);
    int mx=0;
    for(int i=0;i<n;i++)
    {
        cin>>order[i];
        mx=max(order[i],mx);
    }
    for(int i=0;i<n;i++)cin>>fuel[i];
    lli dp[2*mx+1];
    for(int i=0;i<2*mx+1;i++)dp[i]=inf;
    dp[0]=0;
    for(int i=0;i<n;i++)
    {
        for(int j=fuel[i];j<2*mx+1;j++)
        {
            if(dp[j]>dp[j-fuel[i]]+1)dp[j]=dp[j-fuel[i]]+1;
        }
    }
    lli res=0;
    for(int i=0;i<n;i++)
    {
        res+=dp[2*order[i]];
    }
    cout<<res<<endl;
}
int main()
{
    int n ;double d;
    cin>>n>>d;
    int ans=0;
    for(int i=0;i<n;i++)
    {
        double a,b;cin>>a>>b;
        double D=sqrt(abs(a*a) + abs(b*b));
        if(D<=d)ans++;
    }
    cout<<ans<<endl;
}


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

using namespace std;
 
int main() {
  int n; cin >> n;
  int arr[n];
  for(int i=0;i<n;i++){
    cin >> arr[i];
  }

  int min = 0;
  int min_tryk = 0;
  for(int i=1;i<=100;i++){
    int tryk = 0;
    for(int j=0;j<n;j++){
      int a = pow(i-arr[j],2);
      //printf("%d ",a);
      tryk += pow(i-arr[j],2);
    }
    
    //printf("tryk: %d\n",tryk);
    if(i==1){
      min_tryk = tryk;
    }else if(tryk < min_tryk){
      min_tryk = tryk;
      min = i;
    }
  }
  printf("%d\n",min_tryk);

}

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

int main()
{
	string S;
	cin >> S;

	bool hantei = true;

	for (int i = 0; i < S.size(); i++) {
		if ((i+1) % 2 == 0) {
			if (S[i] == 'L'||S[i] == 'U'||S[i] == 'D')
				;
			else
				hantei = false;
		} else if ((i+1) % 2 == 1) {
			if (S[i] == 'R'||S[i] == 'U'||S[i] == 'D')
				;
			else
				hantei = false;
		}
	}

	if (hantei)
		cout << "Yes\n";
	else
		cout << "No\n";
	return 0;
}


Measured memory_bytes: 256
# import numpy as np
import sys, math, heapq
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")

N = int(input())

if N == 0:
    print(1)
else:
    print(0)


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, x, y;
  cin >> n >> x >> y;
  --x; --y;
  vector<int> ans(n);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int cur = abs(i - j);
      cur = min(cur, abs(i - x) + 1 + abs(j - y));
      cur = min(cur, abs(i - y) + 1 + abs(j - x));
      ans[cur] += 1;
    }
  }
  for (int i = 1; i < n; i++) {
    cout << ans[i] << '\n';
  }
  return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;

class Main {
	public static void main(String[] a){
		Scanner scan = new Scanner(System.in);
		
		int h, m, s;
		int startH, startM, startS;
		int endH, endM, endS;
		for(int i = 0; i < 3; i++){
			startH = scan.nextInt();
			startM = scan.nextInt();
			startS = scan.nextInt();
			endH = scan.nextInt();
			endM = scan.nextInt();
			endS = scan.nextInt();
			
			if(startS > endS){
				endS += 60;
				endM--;
			}s = endS - startS;
			
			if(startM > endM){
				endM += 60;
				endH--;
			}m = endM - startM;
			
			h = endH - startH;
			
			System.out.println(h + " " + m + " " + s);
		}
	}
}

Measured memory_bytes: 26128
import java.util.Scanner;
import java.util.stream.LongStream;

public class Main {
    private static final long MOD = 1_000_000_007;

    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int k = scanner.nextInt();

        long max = LongStream.rangeClosed(n - k + 1, n).sum();
        long min = LongStream.range(0, k).sum();

        long sum = max - min + 1;
        sum %= MOD;
        for (int i = k; i <= n; i++) {
            max += n - i;
            min += i;
            sum += max - min + 1;
            sum %= MOD;
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 36032
N, M = map(int, input().split())
edges = [list(map(int, input().split())) for _ in range(M)]

for i in range(M):
    edges[i][2] *= -1

INF = 10 ** 20
d = [INF] * (N + 1)

def bellman_ford():    
    d[1] = 0
    for _ in range(N):
        for u, v, c in edges:
            if (d[u] != INF) and (d[v] > d[u] + c):
                d[v] = d[u] + c

negative = [False] * (N + 1)

def bellman_ford_neg():
    for _ in range(N):
        for u, v, c in edges:
            if (d[u] != INF) and (d[v] > d[u] + c):
                d[v] = d[u] + c
                negative[v] = True
                
            if negative[u]:
                negative[v] = True

bellman_ford()
bellman_ford_neg()

if negative[-1]:
    print('inf')
else:
    print(-d[-1])




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

//var 
int n,k,s;

int main(){
	cin >> n >> k >> s;
	for(int i = 1; i<=k; i++){
		cout << s << " ";
	}
	for(int i = k+1; i<=n; i++){
		cout << (s==1e9?1:s+1) << " ";
	}cout << endl;
}

Measured memory_bytes: 1280
N = int(input())
l = list(map(int,input().split()))
n = 0
for i in range(len(l)):
  if l[i] %2 == 0:
    if l[i] %3 != 0 and l[i] %5 != 0:
      print("DENIED")
      n += 1
      break
      
if n ==0:
  print("APPROVED")

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
# 整数の入力
n = int(raw_input())
# スペース区切りの整数の入力
a,b = map(int, raw_input().split())

l = map(int, raw_input().split())


first=len([x for x in l if x <= a ])
second=len([x for x in l if (x >= a+1 and x<=b)])
third=len([x for x in l if x >= b+1 ])

print min(first,second,third)


Measured memory_bytes: 2568
#include<stdio.h>
#include<math.h>
int main(){
  int data[10000],flag=0,i,j,n=0,sosuu=0;

  scanf("%d",&n);  
  for(i=0;i<n;i++){
    scanf("%d",&data[i]);
    flag=0;
    for(j=2;j<=sqrt(data[i]);j++){
      if(data[i]%j==0){
      flag=1;
      break;
      }
    }
    if(flag==0){
      sosuu++;
    }
  }
  printf("%d\n",sosuu);
}



Measured memory_bytes: 2120
import java.util.*;
import java.io.*;

public class Main {
	static int mod = (int) 1e9 + 7;
	static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };
	static final int INF = Integer.MAX_VALUE / 3;
	static final long LINF = Long.MAX_VALUE / 3;
	
	static int n;
	static List<Integer> graph[];
	static int d[], f[], time;
	
	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		n = fs.nextInt();
		graph = new ArrayList[n];
		for(int i=0;i<n;i++)graph[i] = new ArrayList<>();
		for(int i=0;i<n;i++) {
			int u = fs.nextInt()-1, k = fs.nextInt();
			for(int j=0;j<k;j++) {
				int to = fs.nextInt()-1;
				graph[u].add(to);
			}
		}
		d = new int[n];
		f = new int[n];
		Arrays.fill(d,-1);
		Arrays.fill(f,-1);
		time = 0;
		for(int i=0;i<n;i++) {
			if(d[i]==-1)dfs(i);
		}
		
		for(int i=0;i<n;i++) {
			int id = i+1;
			System.out.println(id + " " + d[i] + " " + f[i]);
		}
	}

	static void dfs(int v) {
		d[v] = ++time;
		for(int to:graph[v]) {
			if(d[to]!=-1)continue;
			dfs(to);
		}
		f[v] = ++time;
	}
	
	//MOD culculations
	static long plus(long x, long y) {
		long res = (x + y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long sub(long x, long y) {
		long res = (x - y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long mul(long x, long y) {
		long res = (x * y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long div(long x, long y) {
		long res = x * pow(y, mod - 2) % mod;
		return res < 0 ? res + mod : res;
	}

	static long pow(long x, long y) {
		if (y < 0)
			return 0;
		if (y == 0)
			return 1;
		if (y % 2 == 1)
			return (x * pow(x, y - 1)) % mod;
		long root = pow(x, y / 2);
		return root * root % mod;
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}


Measured memory_bytes: 24704
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);

        int T;
        T=1;
        while((T--)>0)
        {
            //code comes here
            int K=in.nextInt();
            in.nextLine();
            String str=in.nextLine();
            if(str.length()<=K)
            {
                System.out.println(str);
            }
            else
            {
                System.out.println(str.substring(0, K)+"...");
            }

        }   
        in.close();
    }

}

Measured memory_bytes: 38736
n = int(input())
s = input()

r_cnt = s.count('R')
g_cnt = s.count('G')
b_cnt = s.count('B')
ans = r_cnt * g_cnt * b_cnt

for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:
            break
        if s[i] != s[j] != s[k] != s[i]:
                ans -= 1

print(ans)

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

#define INF 100100100
#define MOD 1000000007

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

int main(int argc, char const* argv[]){
   ios::sync_with_stdio(false);
   cin.tie(0);
   int N;
   cin>>N;
   ull ans = N;
   map<ull,ull>A;
   for(int i=0;i<N;i++){
      int a;
      cin >> a;
      A[a]++;
   }
   ull keep=0;
   for(auto it:A){
      if(it.second >= 2){
         keep+=it.second-1;;
      }
   }
   if(keep%2==0)ans-=keep;
   else ans-=keep+1;
   cout<<ans<<endl;
   return 0;
}


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

using namespace std;
typedef long long ll;

int n;

int main(void)
{
	scanf("%d", &n);
	
	n %= 10;
	
	if(n == 2 || n == 4 || n == 5 || n == 7 || n == 9)
		printf("hon");
	else if(n == 0 || n == 1 || n == 6 || n == 8)
		printf("pon");
	else if(n == 3)
		printf("bon");
	
	return 0;
}

Measured memory_bytes: 3748