akhauriyash/Code-Regression huggingface dataset:
/* 実行時間1s制限の場合
  10^6 1,000,000   : 余裕をもって間に合う
  10^7 10,000,000  : おそらく間に合う
  10^8 100,000,000 : 非常にシンプルな処理でないと厳しい
 */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#include <bits/stdc++.h>
using namespace std;

typedef long long ll; // long longはデータモデル(LLP64, LP64, ...)によらず64bit.
ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;}  // Greatest Common Divisor ユークリッドの互除法（aが長辺）
vector<pair<ll,int>> factorize(ll n) {            // a,bの公約数 = GCD(a, b)の約数
    vector<pair<ll,int>> res;
    for (ll i = 2; i*i <= n; i++) { // √nまで探せばよい
        if (n%i) continue;
        res.emplace_back(i, 0);     // 割り切れたら
        while (n%i == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if (n != 1) res.emplace_back(n, 1); // この時点で1でなかったら、残りは素数.
    return res;
}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}         // Least Commont Multiple オーバーフローしないように先に割る
ll ceil(ll a, ll b) {return (a+b-1)/b;}

const ll INF = LONG_MAX;
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 argc, char* argv[])
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    // std::ifstream in(argv[1]);
    //std::cin.rdbuf(in.rdbuf());
    std::ifstream in("b.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int N, M, C;
    cin >> N >> M >> C;

    vector<int> B(M);
    vector<vector<int>> A(N, vector<int>(M));

    rep(i, M) {
        cin >> B[i];
    }

    rep(i, N) {
        rep(j, M) {
            cin >> A[i][j];
        }
    }

    int ans = 0;
    rep(i, N) {
        int tmp = 0;
        rep(j, M) {
            tmp += A[i][j]*B[j];
        }
        tmp += C;
        if (tmp > 0) {
            ans++;
        }
    }

    cout << ans;

    return 0;
}

/*
  - 1e9 : 10^9
  - container一般
    - 合計
      accumulate(a.begin(), a.end(), 0LL)  0LLはオーバーフロー用
  - vector
    vector<int> A(N, 0); // 0で初期化(省略可)
    - loop
      for  (int i = 0; i < A.size(); i++) {}
      for  (int elem : A) {}
    - sort
      std::sort(v.begin(), v.end());  // 昇順
      std::sort(v.begin(), v.end(), std::greater<int>()); //降順
      - vector<vector<int>> cnt(h, vector<int>(w))
    - sort(struct)
        struct st_t {
            string name;
            int p;
            bool operator<(const st_t& another) const {
                if (name == another.name)
                {
                    return p > another.p;
                }
                return name < another.name;
            }
        };
        vector<st_t> st(n);
        sort(st.begin(), st.end());
  - pair
    - pairのソートの定義 : firstが優先的に比較。同じだったらsecond。
    - pair<pair<string,int>,int> p[110];
      std::sort(p,p+a);
        こうすると、first.first -> first.second -> secondの順にソートされる
    - sort
      - sort(a.begin(), cb.end(), greater<pair<int, int>>());
  - map
    - for (auto x : map) {}  // x.first:key  x.second:value.
  - priority_queue<int> q;
    - q.top()に最大値が入っている
  - string
    - loop
      for (char& c : s) {}
 */



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

using namespace std;

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

int main(){
    int mod = 1000000007;
    int n, m;
    cin >> n >> m;
    int a[m];
    int b[n+1];
    rep(i, n + 1) b[i] = 0;
    rep(i, m) {
        cin >> a[i];
        b[a[i]]++;
    }
    int ans[n+1];
    ans[0] = 1;
    if (b[1] == 0) ans[1] = 1;
    else ans[1] = 0;
    
    rep(i, n-1){
        if (b[i+2] == 0){
            ans[i+2] = ans[i+1] + ans[i];
        }else{
            ans[i+2] = 0;
        }
        ans[i+2] %= mod;
    }
    cout << ans[n] << endl;
}


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

//
#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) |= ~(1 << (b))
#define bitcheck(a, b) (((a) >> (b)) & 1)
#define bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

int N;
int A[202020];

int f(int x) {
  int res = 0;
  for (int i = 0; i < N; i++) {
    res += abs(A[i] - (x + i + 1));
  }
  return res;
}

bool C(int mid) {
  if (f(mid + 1) - f(mid) > 0) return true;
  return false;
}

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

  int ok = 100000000000000000, ng = -10000000000000000;
  for (int i = 0; i < 200; i++) {
    int mid = (ok + ng) / 2;
    if (C(mid)) {
      ok = mid;
    } else {
      ng = mid;
    }
  }

  cout << f(ok) << endl;

  return 0;
}


Measured memory_bytes: 1792
n, m = map(int, input().split())
xxx = sorted(list(map(int, input().split())))
if n >= m:
    ans = 0
else:
    ddd = [0] * (m - 1)
    for i in range(m - 1):
        ddd[i] = xxx[i + 1] - xxx[i]
    ddd = sorted(ddd)
    ans = sum(ddd[:m - n])
print(ans)

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

int main(){
  char c[3][3];

  for(int i = 0; i<3; i++){
    for(int j = 0; j<3; j++){
      cin >> c[i][j];
    }
  }

  cout << c[0][0] << c[1][1] << c[2][2] << endl;
  return 0;
}

Measured memory_bytes: 256
// J'aime
// Chemise Blanche

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr << __LINE__ << " > " << #x << " = " << (x) << endl

int f(int n) {
  int ret = 0;
  while (n) {
    ret += n % 10;
    n /= 10;
  }
  return ret;
}

void MAIN() {
  int n; cin >> n;
  if (n % f(n) == 0) cout << "Yes" << '\n';
  else cout << "No" << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int n, m;
int dp[100001];


int dfs(int u, vector<vector<int>>&adj){
      if(dp[u]!=-1)return dp[u];

      int ans=0;
      for(auto i: adj[u]){
            ans=max(ans, dfs(i, adj)+1);
      }
      if(ans!=0)return dp[u]=ans;
      dp[u]=0;
      return 0;
}

int main(){
      cin>>n>>m;
      memset(dp, -1, sizeof(dp));
      vector<vector<int>>adj(n);
      for(int i=0; i<m; i++){
            int u,v;
            cin>>u>>v;
            adj[u-1].push_back(v-1);
      }
      int ans=0;
      for(int i=0; i<n; i++)
      ans=max(ans, dfs(i, adj));
      cout<<ans;
}

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

class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split();
        int N = int.Parse(input[0]);
        int K = int.Parse(input[1]);
        input= Console.ReadLine().Split();
        int[] x = new int[N];
        for (int i = 0; i <N ; i++)
        {
            x[i] = int.Parse(input[i]);
        }
        int ans = int.MaxValue, temp = 0;
        for(int i =0; i <= N-K; i++)
        {
            temp=Math.Min(Math.Abs(x[i])+Math.Abs(x[i+K-1]-x[i]), Math.Abs(x[i + K - 1]) + Math.Abs(x[i + K - 1] - x[i]));
            ans = Math.Min(ans, temp);
        }
        Console.WriteLine(ans);
    }
}


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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  string s;
  cin >> s;
  int zMax = 0;
  rep(i, s.size()) {
    if (s.at(i) == 'Z') {
      zMax = max(zMax, i);
    }
  }
  int aMinx = s.find('A');
  cout << zMax - aMinx + 1 << endl;
  return 0;
}


Measured memory_bytes: 644
#include <bits/stdc++.h>
    using namespace std;
     
    int main(){
      int a, b, sum = 0;
      cin >> a >> b;
      for(int i = a; i <= b; i++){
        int x = i / 10000; int y = i % 10000 / 1000;
        int z = i / 10 % 10; int w = i % 10;
        if(x == w && z == y) sum++;
      }
      cout << sum << endl;
      return 0;
    }

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define N 100001
using namespace std;
typedef long long ll;
int func(int);
int n,q,e,k;
bool marked[N];
vector<int> edge[N];

int main(){
  char c;
  ll cnt;
  while(1){
    cin>>n>>q;
    if(!n&&!q) break;
    for(int i=0;i<n-1;i++) cin>>e,edge[i+2].push_back(e);
    for(int i=0;i<n-1;i++) marked[i+2]=false;
    marked[1]=true;
    cnt=0;
    while(q--){
      cin>>c>>k;
      if(c=='M') marked[k]=true;
      else cnt+=func(k);
    }
    cout<<cnt<<endl;
    for(int i=2;i<=n;i++) edge[i].clear();
  }
  return 0;
}

int func(int x){
  if(marked[x]) return x;
  return func(edge[x][0]);
}

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

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

int B = s % 100;
int A = (s-B)/100;

if(0<A && A<13){
    if(0<B && B<13)
    cout<<"AMBIGUOUS"<<endl;
    else
    cout<<"MMYY"<<endl;
    
    
}
else if(0<B && B<13)
    cout << "YYMM"<<endl;
else
cout<<"NA"<<endl;
    
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>

#define int long long
#define rr register

#define inf 1e9
#define MAXN 200010

using namespace std;

inline int read() {
	int s = 0, f = 0;
	char ch = getchar();
	while (!isdigit(ch)) f |= ch == '-', ch = getchar();
	while (isdigit(ch)) s = s * 10 + (ch ^ 48), ch = getchar();
	return f ? -s : s;
}

void print(int x) {
	if (x < 0) putchar('-'), x = -x;
	if (x > 9) print(x / 10);
	putchar(x % 10 + 48);
}

int n, m, ans, x, y;

signed main() {
	n = read();
	m = read();
	for (rr int i = 1; i <= n; i++) {
		int x = read();
		int y = read();
		if (sqrt(x * x + y * y) <= m) ans++;
	}
	print(ans);
}

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

namespace ConsoleApplication2
{
    class Program
    {

        static void Main(string[] args)
        {
          
            long a = long.Parse(Console.ReadLine());
            string s = Console.ReadLine();

            if (a >= 3200)
            {
                Console.WriteLine(s);
            }
            else
            {
                Console.WriteLine("red");
            }
            
        }

    }
}

Measured memory_bytes: 11092
{-# LANGUAGE ScopedTypeVariables #-}
import Control.Applicative
import Control.Monad
import Control.Monad.State
import Control.DeepSeq
import Data.Array
import Data.Bits
import Data.Char
import Data.Functor.Identity
import Data.List
import Data.Ord
import Data.Maybe
import Data.Tree
import Data.Tuple
import qualified System.IO
import qualified Data.Map as M
import qualified Data.Set as S
import qualified Data.Sequence as Q
import qualified Data.ByteString.Char8 as B

main = do
  [a,b] :: [Z] <- readLnList
  putStrLn $
    if inRange (a,b) 0
    then "Zero"
    else
      if a > 0 || even (a-b+1) then "Positive" else "Negative"


 
type Z = Int
type Q = Rational
type R = Double
type S = String

fint :: (Integral a, Num b) => a -> b
fint = fromIntegral

getInt = fst . fromJust . B.readInt <$> B.getLine
getIntPair = (\[a,b]->(a,b)) <$> getInts
getInts = map (fst . fromJust . B.readInt) . B.words <$> B.getLine
getStr = B.unpack <$> B.getLine

yesNo :: Bool -> String
yesNo True = "YES"
yesNo False = "NO"

printList :: (Show a) => [a] -> IO ()
printList = putStrLn . unwords . map show

readLnList :: (Read a) => IO [a]
readLnList = map read . words <$> getLine


-----  Union-find
type UnionFindT v m a = StateT (M.Map v (UnionFindVal v)) m a
newtype UnionFindVal v = UnionFindVal v

runUnionFindT :: (Monad m) => UnionFindT v m a -> m a
runUnionFindT = flip evalStateT $ M.empty

runUnionFind = runIdentity . runUnionFindT

ufFresh :: (Monad m, Ord v) => v -> UnionFindT v m ()
ufFresh v = modify $ M.insert v (UnionFindVal v)

ufClass :: (Monad m, Ord v) => v -> UnionFindT v m v
ufClass v = do
  (UnionFindVal pv) <- gets (M.! v)
  if v == pv
    then return v
    else do
      c <- ufClass pv
      modify $ M.insert v (UnionFindVal c)
      return c

ufUnify v w = do
  cv <- ufClass v
  cw <- ufClass w
  modify $ M.insert cw (UnionFindVal cv)
  return $ cv /= cw


Measured memory_bytes: 508
N = int(input())
S = list(input())
R = [0]*N
G = [0]*N
B = [0]*N
for i in range(N):
    if S[i]=="R":
        R[i] += 1
    elif S[i] == "G":
        G[i] += 1
    else:
        B[i] += 1

ans = sum(R)*sum(G)*sum(B)

for i in range(N):
    for j in range(i+1,N):
        k = 2*(j+1)-(i+1)-1
        if  k<N:
            if S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]:
                ans -= 1
                
print(ans)

Measured memory_bytes: 73832
#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"	
	typedef long long LL;
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define mod2 998244353
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define sz(v) ((ll)(v).size())
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define pb push_back
	#define f first
	#define s second
	#define dbg(a) cout<<#a<<" --> "<<(a)<<"\n";
	#define forn(i,n) for (ll i=0; i<(n); ++i)
	#define fornd(i,n) for (ll i=(n)-1; i>=0; --i)	
	#define forab(i,a,b) for (ll i=(a); i<=(b); ++i)
	#define read(a) ll a; cin >> a;
	#define reads(s) string s; cin >> s;
	#define readb(a, b) ll a, b; cin >> a >> b;
	#define readc(a, b, c) ll a, b, c; cin >> a >> b >> c;
	#define readarr(a, n) int a[(n) + 1] = {}; forab(i, 0, (n-1)) {cin >> a[i];}
	#define readmat(a, n, m) int a[n + 1][m + 1] = {}; forab(i, 1, n) {forab(j, 1, m) cin >> a[i][j];}
	#define readv(A,n) vll A(n,0); forn(i,n) cin>>A[i]; 
	#define print(a) cout << a << endl;
	#define printarr(a, n) forab (i, 1, n) cout << a[i] << " "; cout << endl;
	#define printv(v) for (int i: v) cout << i << " "; cout << endl;
	#define printmat(a, n, m) forab(i, 1, n) {forab (j, 1, m) cout << a[i][j] << " "; cout << endl;}
	 
	#define fast_io ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
	using namespace std;
	bool isPowerOfTwo(int x) {
    return x && (!(x & (x - 1)));
	}
	int takemod(int x) {
    return (x % mod + mod) % mod;
	}
 
	int fpow(int base, int power, int MOD) {
    int result = 1;
    base = base % MOD;
    while (power) {
        if (power & 1)
            result = (result * base) % MOD;
        base = (base * base) % MOD;
        power = power >> 1;
    }
    return result;
	}
 
	int modinv(int x) {return fpow(x, mod - 2, mod);}
	void solve()
	{
		ll n;
		cin>>n;
		string A;
		cin>>A;
		vll prer(n+1,0);
		vll prew(n+1,0);
		ll cnt=0;
		forn(i,n)
		{
			if(A[i]=='W')
			{
				prew[i+1]=prew[i]+1;
				prer[i+1]+=prer[i];
			}
			else
			{
				cnt++;
				prer[i+1]=prer[i]+1;
				prew[i+1]+=prew[i];
			}
		}
		if(cnt==n)
		{
			cout<<"0"<<endl;
			return;
		}
		if(cnt==0)
		{
			cout<<0<<endl;
			return;
		}
		ll ans=mod;
		forab(i,0,n-1)
		{
			ll whitef=prew[i];
			ll whitel=prew[n]-prew[i];
			ll redf=prer[i];
			ll redl=prer[n]-prer[i];
			ll minexf=min(whitef,redl);
			ll minexl=min(redf,whitel);
			//dbg(whitef-2*minexf+redl)
			//ans=min(redf-minexl+whitel-minexl,ans);
			ans=min(ans,(whitef-minexf)+(redl-minexf)+minexf);
		}
		cout<<ans<<endl;
	}
	int main()
	{	
		#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		#endif
		fast_io;
		int T=1;
		//cin>>T;
		// cin.ignore(); must be there when using getline(cin, s)
		while(T--)
		{
			solve();
		}
		return 0;
	}

	
	

Measured memory_bytes: 6748
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int n;
    cin >> n;
    int sum = 0;
    vector<int> s;
    rep(i, n) {
        int tmp_s;
        cin >> tmp_s;
        sum += tmp_s;
        if ( tmp_s % 10 != 0 ) {
            s.push_back(tmp_s);
        }
    }
    sort(s.begin(), s.end());
    if ( sum % 10 != 0 ) {
        cout << sum << endl;
        return 0;
    }
    rep(i, s.size()) {
        sum -= s[i];
        if ( sum % 10 != 0 ) {
            cout << sum << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int h,n,i;
  cin>>h>>n;
  vector<int> a(n);
  for(i=0;i<n;i++) {
    cin>>a.at(i);
    h-=a.at(i);
    if (h<=0) break;
  }    
  if (h<=0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 640
def ED(X,Y):
    p=len(X)
    q=len(Y)
    Z=[[0 for i in range(q+1)]for j in range(p+1)]
    for i in range(1,p+1):
        Z[i][0]=Z[i-1][0]+1
    for i in range(1,q+1):
        Z[0][i]=Z[0][i-1]+1
    for i in range(p):
        for j in range(q):
            if X[i]==Y[j]:
              Z[i+1][j+1]=min(Z[i][j],Z[i+1][j]+1,Z[i][j+1]+1)
            else:
                Z[i+1][j+1]=min(Z[i][j]+1,Z[i+1][j]+1,Z[i][j+1]+1)
    return Z[i+1][j+1]
X=input()
Y=input()
c=ED(X,Y)
print(c)


Measured memory_bytes: 42900
#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
using namespace std;
typedef long long ll;

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  int can = b/a;
  cout << min(can, c) << endl;
  return 0;
}


Measured memory_bytes: 256
void main() {
  import std.stdio, std.string, std.conv, std.algorithm;

  int n, m, x, y;
  rd(n, m, x, y);
  auto a = readln.split.to!(int[]);
  auto b = readln.split.to!(int[]);

  for (int z = x + 1; z <= y; z++) {
    auto ok = reduce!((r, e) => (r && e < z))(true, a) && reduce!((r, e) => (r && e >= z))(true, b);
    if (ok) {
      writeln("No War");
      return;
    }
  }
  writeln("War");
}

void rd(T...)(ref T x) {
  import std.stdio, std.string, std.conv;

  auto l = readln.split;
  assert(l.length == x.length);
  foreach (i, ref e; x)
    e = l[i].to!(typeof(e));
}


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

int main(void)
{
    int n;

    char buf[64];
    fgets(buf, sizeof(buf), stdin);
    sscanf(buf, "%d", &n);

    bool cards[4][13];
    memset(cards, 0, sizeof(cards));

    char mark_c;
    int mark, num;
    for(int i = 0; i < n; i++){
        fgets(buf, sizeof(buf), stdin);
        sscanf(buf, "%c %d", &mark_c, &num);

        switch(mark_c){
        case 'S': mark = 0; break;
        case 'H': mark = 1; break;
        case 'C': mark = 2; break;
        case 'D': mark = 3; break;
        default:
            exit(1);
        }
        cards[mark][num-1] = true;
    }

    char *mark_str = "SHCD";

    for(int j = 0; j < 4; j++){
        for(int i = 0; i < 13; i++){
            if(!cards[j][i]){
                printf("%c %d\n", mark_str[j], i + 1);
            }
        }
    }

    return 0;
}

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

#define HASHSIZE 1048583 // over 2^20 prime number
#define MAX_KW_LEN 16
#define CMND_LEN 8

#define TRUE 1
#define FALSE 0

struct list {
  char keyword[MAX_KW_LEN];
  struct list *next;
};

struct list *hashtable[HASHSIZE];

int Hash(char *key) {
  int hashval = 0;
  
  while (*key != '\0') 
    hashval = (hashval * 43 + *key++) % HASHSIZE;
  return (hashval % HASHSIZE); // 0 ~ HASHSIZE -1
}

int FindKeyWord(char *key) {
  struct list *p;
  
  for (p = hashtable[Hash(key)]; p != NULL; p = p->next)
    if (!strcmp(key, (*p).keyword))
      return (TRUE);
  // Not found
  return (FALSE);
}

void RegistHTable(char *key) {
  int hashval;
  struct list *p, *q;

  if ((FindKeyWord(key)) == FALSE) {
    if ((p = (struct list *)malloc(sizeof(struct list))) == NULL) {
      fprintf(stderr, "Lack of memory\n");
      exit(2);
    }

    strcpy((*p).keyword, key);
    hashval = Hash(key);
			
    if (hashtable[hashval] == NULL) {
      hashtable[hashval] = p;
      p->next = NULL;
    }
    else {
      q = hashtable[hashval];
      while (q->next != NULL)
	q = q->next;
      q->next = p;
      p->next = NULL;
    }
  }
}

void FreeKeyWord(void) {
  int i;
  struct list *p, *q;

  for (i = 0; i < HASHSIZE; i++)
    for (p = hashtable[i]; p != NULL; ) {
      q = p->next;
      free(p);
      p = q;
    }
}

int main(void) {
  char word[MAX_KW_LEN], command[CMND_LEN];
  int i, n;

  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%s %s", command, word);
    if (!strcmp(command, "insert")) {
      if (!(FindKeyWord(word)) == TRUE)
	RegistHTable(word);
    }
    else if (!strcmp(command, "find")) {
      if ((FindKeyWord(word)) == TRUE)
	printf("yes\n");
      else
	printf("no\n");
    }
    else
      printf("Not available command!");
  }

  FreeKeyWord(  );
  return 0;
}

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

int main(){
 int n;
 cin >> n;
 map<string, int> mp;//mp=出現回数
 for (int i=0;i<n;i++){
   string s;
   cin >> s;
   mp[s]++;
 }
  
 int mx=0;
 for (auto p:mp) mx=max(mx, p.second);
 for (auto p:mp){
   if (p.second!=mx) continue;
   cout << p.first << endl;
 }
}


Measured memory_bytes: 25216
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>
 
using namespace std;
 
int main(){
	vector<int> a(3,0);
	vector<int> b(3,0);
	vector<int> c(4,0);
	
	for(int i=0;i<3;i++){
		cin >> a[i] >> b[i];
		if(a[i]==b[i]){
			cout << "NO" << endl;
			return 0;
		}
		c[a[i]-1]++;
		c[b[i]-1]++;
	}
	
	for(int i=0;i<4;i++){
		if(c[i]>=3 || c[i] <=0){
			cout << "NO" << endl;
			return 0;
		}
	}
	
	cout << "YES" << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int n;
    cin >> n;
    ll a[n];
    rep(i,n)cin >> a[i];
    map<ll,int> mp;
    rep(i,n){
        mp[i+a[i]]++;
    }
    ll ans = 0;
    rep(i,n){
        ans += mp[i-a[i]];
    }
    cout << ans << endl;
}

Measured memory_bytes: 27740
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include<limits>
#include<iomanip>
#include<cassert>

using namespace std;

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

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n-1;i >= 0;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second

const long double pi = 3.141592653589793;
const int mod = 998244353;


int main() {

 // freopen("input.in","r",stdin);
 // freopen("output.out","w",stdout);

 int a;cin>>a;
 cout<<a*(1+a*(1+a)) <<endl;

 return 0;
}


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

int main() {
    int n;
    cin>>n;
    vector<int> mao(n);
    for(int i=0; i<n; i++) cin>>mao.at(i);

    for(int i=0; i<n-1; i++) {
        for(int j=i+1; j<n; j++) {
            if(mao.at(i)>mao.at(j)) {
                int hanoi = mao.at(i);
                mao.at(i) = mao.at(j);
                mao.at(j) = hanoi;
            }
        }
    }

    int ans = 0;
    for(int i=0; i<n-2; i++) {
        for(int j=i+1; j<n-1; j++) {
            for(int k=j+1; k<n; k++) {
                if(mao.at(i)+mao.at(j)>mao.at(k)) ans++;
                else break;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

#define maxn 200010

#define cabs(_x) ((_x) < 0 ? (-(_x)) : (_x))
typedef long long ll;
int a[maxn];
int main()
{
	int n; scanf("%d", &n);
	for (int i = 1; i <= n; ++i) scanf("%d", a + i), a[i] -= i;
	std::sort(a + 1, a + n + 1);
	int mid = n + 1 >> 1;
	ll ans = 0;
	for (int i = 1; i <= n; ++i) ans += cabs(a[i] - a[mid]);
	printf("%lld\n", ans);
	return 0;
}

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

int main(){ 
    Int N, K, p, A, B, C, BtimesC, ans, inv;

    cin >> N >> K;
    p = 1000000007;

    A = N + 2 - K;
    B = N + 1 - K;
    C = (N + 2 * K) % p;

    BtimesC = (B * C) % p;

    ans = ((BtimesC + 6) * A) % p;


    vector<Int> L(11);

    L[1] = 6;
    rep1(i,9) {
        L[i+1] = (((((((((((((((((L[i] * L[i]) % p) * L[i]) % p) * L[i]) % p) * L[i]) % p) * L[i]) % p) * L[i]) % p) * L[i]) % p) * L[i]) % p) * L[i]) % p;
    }

    inv = (((((((((L[10] * 6) % p) * 6) % p) * 6) % p) * 6) % p) * 6) % p;

    //rep1(i,10) cout << L[i] << endl;

    cout << ans * inv % p << endl;







}

Measured memory_bytes: 3608
import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] nums;
        int h, w, i, j;
        while (true) {
            nums = br.readLine().split(" ");
            h = Integer.parseInt(nums[0]);
            w = Integer.parseInt(nums[1]);
            if (h == 0 && w == 0) break;
            for (i = 0; i < h; i++) {
                for (j = 0; j < w; j++) {
                    if (i == 0 || i == h-1 || j == 0 || j == w-1) System.out.print("#");
                    else System.out.print(".");
                }
                System.out.println();
            }
            System.out.println();
        }
    }
}

Measured memory_bytes: 32624
#include <iostream>
#include<cmath>
using namespace std;
bool sosuu(int x){
    if(x==2)return true;
    else if(x==1)return false;
    else if(x%2==0)return false;
    else{
        for(int i=3;i<=sqrt(x);i=i+2){
            if(x%i==0)return false;
        }
        
    }
    
    return true;
    
}
int main(){
    int n;
    cin>>n;
    int ans=0;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        if(sosuu(x))ans++;//cout<<x<<endl;
    }
    cout<<ans<<endl;
    
return 0;
}



Measured memory_bytes: 3104
using System;
public class Program
{
    public static void Main()
    {
        string[] input1 = Console.ReadLine().Split(' ');
        string[] input2 = Console.ReadLine().Split(' ');
        int n = int.Parse(input1[0]);
        int m = int.Parse(input1[1]);
        int x = int.Parse(input1[2]);
        
        int left = 0;
        int right = 0;
        
        foreach(var a in input2)
        {
            if(int.Parse(a) < x)
            {
                left += 1;
            }
            
            if(int.Parse(a) > x)
            {
                right += 1;
            }
        }
        
        Console.WriteLine(Math.Min(left,right));
        
        
    }
}


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

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(a) (a).begin(),(a).end()
#define CHMIN(a, b) a = min((a),(b))
#define CHMAX(a, b) a = max((a),(b))
const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b) {
        cout << c << endl;
    } else if (a == c) {
        cout << b << endl;
    } else {
        cout << a << endl;
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())
S = list(str(input()))

ans = 0
for i in range(1, N):
    tmp = 0
    X = set(S[:i])
    Y = set(S[i:])
    for x in X:
        if x in Y:
            tmp += 1
    ans = max(ans, tmp)

print(ans)

Measured memory_bytes: 9140
using System;
class P
{
    static void Main()
    {
        string[] s = Console.ReadLine().Split();
        int m = int.Parse(s[1]);
        int[][] ab = new int[m][];
        for (int i = 0; i < m; i++)
        {
            ab[i] = new int[2];
            s = Console.ReadLine().Split();
            ab[i][0] = int.Parse(s[0]);
            ab[i][1] = int.Parse(s[1]);
        }
        Array.Sort(ab, (a, b) => a[1] - b[1]);
        int ans = 0;
        int t = 0;
        for (int i = 0; i < m; i++)
        {
            if (t <= ab[i][0])
            {
                ans++;
                t = ab[i][1];
            }
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 23368
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;


int main(){
    int N; cin >> N;
    vector<int> a(N);
    int S = 0;
    rep(i, N){
        cin >> a[i];
        S ^= a[i];
    }

    rep(i, N){
        int ans = S ^ a[i];
        cout << ans << " ";
    }
    cout << endl;
}

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

namespace ABC
{
    class ABC169A
    {
        const string FILE = @"..\..\data.txt";

        static void Main(string[] args)
        {
#if DEBUG
            Console.SetIn(new StreamReader(FILE));
#endif
            var s = Console.ReadLine();

            char c = s.ToCharArray()[s.Length - 1];


            string result = "hon";
            if (c == '3')
            {
                result = "bon";
            }
            else if (c == '0' || c == '1' || c == '6' || c == '8')
            {
                result = "pon";
            }
            Console.WriteLine(result);

#if DEBUG
            Console.SetIn(Console.In);
            Console.ReadKey();
#endif
        }
    }
}


Measured memory_bytes: 25656
#include <bits/stdc++.h>
#define R(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  double c,b;
  int a[4][2]={0};
  while(cin>>c>>b){
    if(c>1.0)a[0][0]++;
    else if(c>0.5)a[1][0]++;
    else if(c>0.1)a[2][0]++;
    else a[3][0]++;
    if(b>1.0)a[0][1]++;
    else if(b>0.5)a[1][1]++;
    else if(b>0.1)a[2][1]++;
    else a[3][1]++;
  }
  R(i,4)cout<<a[i][0]<<' '<<a[i][1]<<endl;
}

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

int main() {
  int n, m, f = 0, tmp = 10;
  cin >> n;
  m = n;

  while((tmp / 10) <= m){
    f += m % tmp / (tmp / 10);
    m -= m % tmp;
    tmp *= 10;
  }
  if (n % f == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
//l={1,2,3,4}
//sort(l,l+N,greater<int>());	降順ソート
//sort(l,l+N);	昇順ソート
//string 変数　　変数.size()で数字化


int main(void)
{
	int n, time[105];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> time[i];
	}

	int m;
	cin >> m;
	int kime[105][3];
	for (int i = 0; i < m; i++) {
		cin >> kime[i][0];
		cin >> kime[i][1];
	}

	for (int i = 0; i < m; i++) {
		int ans = 0;
		int tmp = time[kime[i][0] - 1];
		time[kime[i][0] - 1] = kime[i][1];
		for (int j = 0; j < n; j++) {
			ans += time[j];
		}
		cout << ans << endl;
		time[kime[i][0] - 1] = tmp;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define X first
#define Y second
#define mp make_pair
using namespace std;
typedef pair<int,int> PII;
typedef long long ll;
const int N = 100010;
int t[N];
int n,c,k,ans;
multiset<int> S;
int main(){
	scanf("%d",&n);
	scanf("%d%d",&c,&k);
	for(int i=0;i<n;i++)scanf("%d",t+i);
	sort(t,t+n);
	for(int i =0;i<n;i++){
		while(S.size()>0 && *S.begin()<t[i]){
			ans++;
			int cnt = c;
			while(cnt && S.size()>0){
				S.erase(S.begin());
				cnt--;
			}
		}
		S.insert(t[i]+k);
	}
	while(S.size()>0){
			ans++;
			int cnt = c;
			while(cnt && S.size()>0){
				S.erase(S.begin());
				cnt--;
			}
		}
		//S.insert(t[i]+k);
	printf("%d\n",ans);
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    float ans;
    if (n%2==0){
        ans = n/2;
        ans /= n;
    }else{
        ans = ((n-1)/2)+1;
        ans /= n;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.*
import java.util.*

fun main(args: Array<String>) {
    val inputStream = System.`in`
    val outputStream = System.out
    val inp = Main.InputReader(inputStream)
    val out = PrintWriter(outputStream)
    val solver = Main.TaskA()
    solver.solve(inp, out)
    out.close()
}

class Main {
    internal class TaskA {
        fun solve(inp: InputReader, out: PrintWriter) {
            val a = inp.nextInt()
            val b = inp.nextInt()
            if (a <= 9 && b <= 9)
                out.println(a * b)
            else
                out.println(-1)
        }
    }

    internal class InputReader(stream: InputStream) {
        private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)
        private var tokenizer: StringTokenizer? = null

        init {
            tokenizer = null
        }

        operator fun next(): String {
            while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
                try {
                    tokenizer = StringTokenizer(reader.readLine())
                } catch (e: IOException) {
                    throw RuntimeException(e)
                }
            }
            return tokenizer!!.nextToken()
        }

        fun nextInt(): Int {
            return Integer.parseInt(next())
        }

        fun nextLong(): Long {
            return next().toLong()
        }
    }
}


Measured memory_bytes: 31380
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
//#define INF 1145141919
#define INF 2147483647
#define MOD 1000000007
#define MAX_N (1<<17) // 10^5

struct SegTree {
  int seg[MAX_N*2-1], lazy[MAX_N*2-1];
  SegTree() {
    for (int i=0; i<MAX_N*2-1; i++) seg[i] = INF, lazy[i] = INF;
  }
  inline void setLazy(int k, int v) {
    lazy[k] = v;
    seg[k] = v;
  }
  inline void fix(int k) {
    seg[k] = max(seg[k*2+1], seg[k*2+2]);
  }
  inline void push(int k) {
    if (lazy[k] == INF) return;
    setLazy(k*2+1, lazy[k]);
    setLazy(k*2+2, lazy[k]);
    lazy[k] = INF;
  }

  void fill(int a, int b, int x, int k=0, int l=0, int r=MAX_N) {
    if (r <= a || b <= l) return;
    if (a <= l && r <= b) {
      setLazy(k, x);
      return;
    }
    push(k);
    fill(a, b, x, k*2+1, l, (l+r)/2);
    fill(a, b, x, k*2+2, (l+r)/2, r);
    fix(k);
  }

  int query(int a, int b, int k=0, int l=0, int r=MAX_N) {
    if (r <= a || b <= l) return 0;
    if (a <= l && r <= b) return seg[k];
    push(k);
    return max(
      query(a, b, k*2+1, l, (l+r)/2),
      query(a, b, k*2+2, (l+r)/2, r)
    );
  }
};

int N, Q;
SegTree seg;

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> Q;
  rep(i, Q) {
    int t;
    cin >> t;
    if (t == 0) {
      int l, r, x;
      cin >> l >> r >> x;
      seg.fill(l, r+1, x);
    }
    else {
      int i;
      cin >> i;
      cout << seg.query(i, i+1) << "\n";
    }
  }
  return 0;
}

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

int main(){
    int N; cin >> N;
    vector<pii> P(N);
    rep(i, 0, N){
        int x,l; cin >> x >> l;
        P[i].first = x + l;
        P[i].second = x-l;
    }

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

    int ans = 0, t = -1e9 - 10;
    rep(i, 0, N){
        if(t <= P[i].second){
            //cout << i << endl;
            ans++;
            t = P[i].first;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <stdio.h>
 
using namespace std;
 
#define int long long
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)

void solve();

signed main () {
    cout.precision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
    #endif
    int t = 1; 
    // cin >> t;	
    int tt = t;
    while (t--) { 
        solve();
    }
    return 0;
}
int a[5], b[5], t[5];
void lol() {
	cout << "infinity\n";
	exit(0);
}

void solve() {
	cin >> t[1] >> t[2];
	cin >> a[1] >> a[2];
	cin >> b[1] >> b[2];
	a[1] -= b[1];
	a[2] -= b[2];
	if (a[1] < 0)
		a[1] *= -1, a[2] *= -1;
	if (a[2] > 0) {
		cout << 0;
		return;
	}
	if (a[1] * t[1] + a[2] * t[2] == 0) {
		lol();
	}
	if (a[1] * t[1] + a[2] * t[2] < 0) {
		a[1] *= -1;
		a[2] *= -1;
	}
	if (a[1] > 0) {
		cout << 0;
		return;
	}
	int pos = a[1] * t[1] + a[2] * t[2];
	// int ans = 2 * (pos / (-a[1] * t[1]));
	int ans = 2 * ((-a[1] * t[1]) / pos);
	if ((-a[1] * t[1]) % pos)
		++ans;
	cout << ans;
}     	

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
 long long i,e,n,min,max,sum=0;

 scanf("%d", &n);

 int a[100000];

 for(i=0;i<n;i++)
 {
  scanf("%ld", &a[i]);
  sum= sum + a[i];
 }

  min=a[0];
  max=a[0];

 for(e=1;e<n;e++)
 {
    if(a[e]<min)
     min=a[e];

    if(a[e]>max)
     max=a[e];
   }

 printf("%ld %ld %ld\n", min, max, sum);

return 0;
}

Measured memory_bytes: 644
package main

import (
	"fmt"
	"math"
)

var a, b, c int
var ans int

func main() {
	fmt.Scan(&a, &b, &c)

	fmt.Println(min(a+b, b+c, c+a))
}

/*  ----------------------------------------  */

func gcd(x, y uint64) uint64 {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

func combination(x, y int) int {
	return permutation(x, y) / permutation(y, y)
}

func permutation(x, y int) int {
	var ans int = 1
	for i := x - y; 0 < i; i-- {
		ans *= i
	}
	return ans
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}

func pow(x, y int) uint64 { return uint64(math.Pow(float64(x), float64(y))) }
func abs(x int) int       { return int(math.Abs(float64(x))) }
func floor(x int) int     { return int(math.Floor(float64(x))) }

type XY struct {
	x int
	y int
}

type SortBy [][]int

func (a SortBy) Len() int      { return len(a) }
func (a SortBy) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool {
	if a[i][0] == a[j][0] {
		return a[i][1] > a[j][1]
	}
	return a[i][0] > a[j][0]
}


Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main() {
	int height[10];
	int i,j;
	int tmp;

	for (i = 0; i < 10; i++) {
		scanf("%d", &height[i]);
	}
	for (i = 9; i >= 7; i--) {
		for (j = 0; j < i; j++) {
			if (height[j] > height[j + 1]) {
				tmp = height[j + 1];
				height[j + 1] = height[j];
				height[j] = tmp;
			}
		}
	}
	
	for (i = 9; i >= 7; i--) {
		printf("%d\n", height[i]);
	}
	return 0;
}

Measured memory_bytes: 600
#define _USE_MATH_DEFINES 
#include <cmath>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<vector>
#include<cctype>
#define rep(i,start,n) for(int i=start;i<n;i++)
#define And &&
#define Or ||
#define Lb cout<<endl
using namespace std;

int main(void) {
	int n; cin >> n;
	int Poftaro=0, Pofhanako=0;
	rep(i, 0, n) {
		string taro, hanako;
		cin >> taro >> hanako;
		if (taro > hanako) Poftaro += 3;
		else if (taro == hanako) {
			Poftaro++;
			Pofhanako++;
		}
		else Pofhanako += 3;
	}
	cout << Poftaro << " " << Pofhanako << endl;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
#define ll long long
#define debug(a) cout<<a<<endl
#define pii pair<ll,ll>
#define INF (int) 1e9+7
#define maxn 109
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin>>s;
    bool cond=false;
    for(int i=0;i<s.size();i++){
        if(i!=0 && s[i]==s[i-1])cond=true;
    }
    if(cond)cout<<"Bad"<<endl;
    else cout<<"Good"<<endl;
    return 0;
}
///usar double sempre ou long double
///pensar em casos que coisas dao negativas
///N esquecer de limpar as coisas em quest de varios testes
///OLHAR A COMPLEXIDADE PRA VER SE N PASSA POR BRUTE FORCE OU BRUTE FORCE COM ALGUMAS OTIMIZACOES


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define endl        "\n"
#define mod         2019

map<int,int>m;
int main()
{
   string s;
   cin>>s;
   m[0]=1;
   int sum=0, ten=1;
   ll ans=0;

  for(int i=s.size()-1;i>=0;i--)
   {
       int d=s[i]-'0';
       sum=(sum+(d*ten))%mod  ;
       ten=(ten*10)%mod;
       ans+=m[sum];
        m[sum]++;

        //cout<<sum<<endl;

   }

   cout<<ans<<endl;
}








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

int main()
{
  int a1, a2, b1, b2;
  cin >> a1 >> a2 >> b1 >> b2;
  if (a1 + a2 > b1 + b2) cout << "Left" << endl;
  else if (a1 + a2 < b1 + b2) cout << "Right" << endl;
  else cout << "Balanced" << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int N, Y;
    cin >> N >> Y;
    int res10000 = -1, res5000 = -1, res1000 = -1;
    for (int a = 0; a <= N; a++) {  
        for (int b = 0; b + a <= N; b++) {  
          int c = N - a - b; 
            int total = 10000*a + 5000*b + 1000*c;
            if (total == Y) { 
              res10000 = a;
                res5000 = b;
                res1000 = c;
            }
        }
    }
    cout << res10000 << " " << res5000 << " " << res1000 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<sstream>
#include<string>
#include<vector>
#include <cmath>
#include <limits>
#include <queue>
#include<algorithm>
 
using namespace std;
 
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define p pair<int,int>
 
int main(){
    int n, k;
    long long s;
    cin >> n >> k >> s;
    rep(i,k){
        cout << s << " ";
    }
    rep(i,n-k){
        if (s == 1000000000){
            cout << s-1 << " ";
        }
        else{
            cout << 1000000000 << " ";
        }
    }

 
    return 0;
}

Measured memory_bytes: 1280
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int S = sc.nextInt();
        int h = S/3600;
        int m = (S-h*3600)/60;
        int s = S-(h*3600)-(m*60);
        System.out.println(h+":"+m+":"+s);
    }
}


Measured memory_bytes: 26156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

int main() {
    string S,ans;
    cin >> S;
    ans = "Yes";
    for(int i = 0;i < S.length();i++){
        if(i % 2 != 0){
            if(S[i] == 'R'){
                ans = "No";
                break;
            }
        }else{
            if(S[i] == 'L'){
                ans = "No";
                break;
            }
        }
            
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
using ll = long long;

int main(){
        int i,j,ri,ci,r,c,k;
        ll v,tmp;
        cin >> r >> c >> k;
        vector<vector<vector<ll>>> dp(r+1, vector<vector<ll>>(c+1, vector<ll>(4)));
        vector<vector<ll>> mp(r+1, vector<ll>(c+1));
        vector<vector<ll>> val(r+1, vector<ll>(c+1));
        for(i=0;i<k;++i){
                cin >> ri >> ci >> v;
                mp.at(ri).at(ci) = v;
        }
        for(i=1;i<r+1;++i){
                for(j=1;j<c+1;++j){
                        for(k=0;k<4;++k){
                                if(mp.at(i).at(j)==0){
                                        if(k==0){
                                                dp.at(i).at(j).at(k) = max(dp.at(i).at(j-1).at(k), val.at(i-1).at(j));
                                        }else{
                                                dp.at(i).at(j).at(k) = dp.at(i).at(j-1).at(k);
                                        }
                                }else{
                                        if(k==0){
                                                dp.at(i).at(j).at(k) = max(dp.at(i).at(j-1).at(k), val.at(i-1).at(j));
                                        }else if(k==1){
                                                dp.at(i).at(j).at(k) = max(dp.at(i).at(j-1).at(k), dp.at(i).at(j).at(k-1)+mp.at(i).at(j));
                                        }else{
                                                dp.at(i).at(j).at(k) = max(dp.at(i).at(j-1).at(k), dp.at(i).at(j-1).at(k-1)+mp.at(i).at(j));
                                        }
                                }
                                val.at(i).at(j) = max(val.at(i).at(j), dp.at(i).at(j).at(k));
                        }
                }
        }
        cout << val.at(r).at(c) << endl;
        return 0;
}

Measured memory_bytes: 777408