akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using E = System.Linq.Enumerable;
 
class Program
 {

        static void Main(string[] args)
        {
          //入力を受け取る
          var N = long.Parse(Console.ReadLine());
          //var A = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
          var AllLcm = long.Parse(Console.ReadLine());
          for(int i = 1; i < N ; i++){
            var T = long.Parse(Console.ReadLine());
           // Console.WriteLine(T);
            AllLcm = Lcm(T,AllLcm);
            
          }
          
          Console.WriteLine(AllLcm);
        }
  
        // 最小公倍数
        public static long Lcm(long a, long b) {
            return a * (b / Gcd(a, b));
        }

        // ユークリッドの互除法 
        public static long Gcd(long a, long b) {
            if (a < b)
                // 引数を入替えて自分を呼び出す
                return Gcd(b, a);
            while (b != 0) {
                var remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;
        }
  
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
#define fi first
#define se second
#define pi pair<ll,ll>
#define pii pair<ll,pi>
#define pb push_back
#define mk make_pair;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
int h, w;
char a[55][55];
bool vis[55][55];
int dp[55][55];
bool ok(int i, int j) {
	return (i >= 0 && i < h && j >= 0 && j < w);
}
void bfs(int i, int j) {
	for (int x = 0; x < 55; x++) {
		for (int y = 0; y < 55; y++) {
			dp[x][y] = 1e9;
		}
	}
	dp[i][j] = 1;
	vis[i][j] = true;
	queue<pi>q;
	q.push({i, j});
	while (!q.empty()) {
		pi v = q.front();
		ll x = v.fi;
		ll y = v.se;
		q.pop();
		for (int k = 0; k < 4; k++) {
			ll nx = x + dx[k];
			ll ny = y + dy[k];
			if (ok(nx, ny) && !vis[nx][ny] && a[nx][ny] == '.') {
				dp[nx][ny] = min(dp[nx][ny], 1 + dp[x][y]);
				vis[nx][ny] = true;
				q.push({nx, ny});
			}
		}
	}
}
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> h >> w;
	int white = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a[i][j];
			if (a[i][j] == '.')white++;
		}
	}
	bfs(0, 0);
	//cout << dp[h - 1][w - 1] << endl;
	if (dp[h - 1][w - 1] == 1e9)
		cout << "-1" << endl;
	else
		cout << white - dp[h - 1][w - 1] << endl;
}


Measured memory_bytes: 3636
#include<stdio.h>

int main(){
	int N,i,max=0;
	scanf("%d",&N);
	int P[N],a[N+1];
	for(i=0;i<=N;i++)a[i]=0;
	for(i=0;i<N;i++){
		scanf("%d",&P[i]);
		a[P[i]]=a[P[i]-1]+1;
	}
	for(i=0;i<=N;i++)if(max<a[i])max=a[i];
	printf("%d\n",N-max);
	return 0;
}

Measured memory_bytes: 1664
#include <algorithm>
#include <vector>
#include <iostream>
#include <cmath>
#include <set>
#include <string>
#include <list>
using namespace std;


int main()
{
	int n;
	cin >> n;
	long long res = 0;
	long long c = 0;
	while (c <= n)
	{	
		if(c%3!=0 && c%5!=0)
			res += c;
		++c;
	}
	cout << res <<endl;
}

Measured memory_bytes: 3672
/*
LANG:C++
PROB:

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
// #define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)


using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
typedef unsigned long long ui64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
const int mod=1000000007;
  i64 poww(i64 a, i64 b)
  {
    a%=mod;
    i64 res=1;
    while(b)
      {
if(b&1)res=res*a%mod;

      a=a*a%mod;
      b/=2;

      }
      return res;
  }
  i64 inv(i64 a)
  {
    return poww(a,mod-2);
  }
  void solve()
  {

int x;
cin>>x;
cout<<((x>=30)?"Yes":"No");
  }
  
  int main()
  {
ios::sync_with_stdio(false);
    cin.tie(nullptr);
    #ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
    #endif
int t=1;
while(t--)
{
  solve();
}

    return 0;
  }


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

/*
テストケース全てに目を通す
テストケースが2個以下だったらなんかある
N最小のコーナーケースがないか調べる
制約をしっかりと確認する（1からNまでの順列、全て異なる値などの制約も含め）
操作の逆順を考える
Codeforcesではscanfを使う
 */

struct edge{ll to,cost;};
ll V;
vector<edge> G[100010];
ll d[100010];
void dijkstra(ll s){
    priority_queue<pll,vector<pll>,greater<pll>> que;
    fill(d,d+V,INF);
    d[s]=0;
    que.push(pll(0,s));
    while(!que.empty()){
        pll p=que.top();
        que.pop();
        ll v=p.S;
        if(d[v]<(p.F))continue;
        rep(i,sz(G[v])){
            edge e=G[v][i];
            if(d[e.to]>d[v]+e.cost){
                d[e.to]=d[v]+e.cost;
                que.push(pll(d[e.to],e.to));
            }
        }
    } 
}

int main() {
    cin >> V;
    rep(i,V-1){
        ll x,y,z;
        cin >> x >> y >> z;
        G[x-1].pb({y-1,z});
        G[y-1].pb({x-1,z});
    }
    dijkstra(0);
    rep(i,V){
        if(d[i]%2==0)cout << 0 << endl;
        else cout << 1 << endl;
    }
}

/*



 */



Measured memory_bytes: 8704
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, m, p, r, g;
// int red[N], green[N], col[N];

int32_t main(){_
   
   cin>>r>>g>>n>>m>>p;

   vector<int> red(n), green(m), col(p);

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

   for (int i = 0; i < m; ++i)
   {
      cin >> green[i];
   }
   
   for (int i = 0; i < p; ++i)
   {
      cin >> col[i];
   }
   
   sort(red.rbegin(), red.rend());
   sort(green.rbegin(), green.rend());
   sort(col.rbegin(), col.rend());

   int ans = 0;
   multiset<int> ms;
   for (int i = 0; i < r; ++i)
   {
      ans += red[i];
      ms.insert(red[i]);
   }

   for (int i = 0; i < g; ++i)
   {
      ans += green[i];
      ms.insert(green[i]);
   }

   int ptr = 0;
   while(!ms.empty() and ptr < (int)(col.size())){
      int vals = *ms.begin();
      ms.erase(ms.begin());
      if(vals > col[ptr])
         break;
      ans -= vals;
      ans += col[ptr++];
   }

   cout<<ans;

   return 0;
}

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

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

    long long a, b;
    a = 2;
    b = 1;

    for (int i = 0; i < N-1; i++) {
        long long temp = b;
        b += a;
        a = temp;
    }

    cout << b << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<numeric>
#include<math.h>
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 ans = 0;
    for ( int i = 1; i <= 50000; ++i ) {
        int x = i * 108 / 100;
        if ( x == n ) {
            ans = i;
            break;
        }
    }
    if ( ans == 0 ) cout << ":(" << endl;
    else            cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
def main():
    b = int(input())
    d = dict()

    for i in range(b):
        s = input()
        if s in d:
            d[s] += 1
        else:
            d[s] = 1

    r = int(input())

    for i in range(r):
        s = input()
        if s in d:
            d[s] -= 1
        else:
            d[s] = -1

    print(max(max(d.values()),0))







if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

		Scanner stdin = new Scanner(System.in);
		int d = stdin.nextInt();
		int l = stdin.nextInt();

		int jump = d % l;
		int jumpNumber = d / l;

		if(jump == 0) {
			System.out.println(jumpNumber);
		} else {
			int result = jump + jumpNumber;
			System.out.println(result);
		}
	}

}

Measured memory_bytes: 26184
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <cmath>
using namespace std;
typedef long long ll;
ll a[100010];
vector<ll> v,w;
map<ll,ll> mp;
set<ll> s;
bool prime(ll x){
	for(ll i=2;i*i<=x;i++){
		if(x%i==0) return false;
	}
	return true;
}

ll solve(ll x){
	for(int j=0;j<v.size();j++){
		while(x%v[j]==0){
			x /= v[j];
			if(x==1){
				return 1;
			}
		}
	}
	return x;
}

ll solve1(ll x){
	ll res1 = 1,res2 = 1;
	for(int i=0;i<w.size();i++){
		if(x%w[i]==0 && x%(w[i]*w[i])==0){
			res2 *= w[i];
			x /= w[i]*w[i];
		}else if(x%w[i]==0){
			res1 *= w[i];
			x /= w[i];
		}
	}
	if(x!=1){
		if(s.count(x)) res2 *= (ll)sqrt(x);
		else res1 *= x;
	}
	if(res1>100000) return -1;
	else return res1*res1*res2;
}

int main(){
	ll i,n,ans = 0;
	cin >> n;
	for(i=2;i<=100000;i++){
		bool flag = prime(i);
		if(i<=9973 && flag) w.push_back(i);
		if(i<=2154 && flag) v.push_back(i*i*i);
		s.insert(i*i);
	}
	for(i=0;i<n;i++){
		cin >> a[i];
		ll b = solve(a[i]);
		mp[b]++;
	}
	for(auto x:mp){
		ll y = x.first;
		if(y==1) continue;
		ll z = solve1(y);
		if(mp.find(z)==mp.end()) ans += 2*x.second;
		else ans += max(x.second,mp[z]);
	}
	ans /= 2;
	if(mp[1]) ans++;
	cout << ans << endl;
}

Measured memory_bytes: 14080
from itertools import permutations

n = int(input())
x, y = [0]*n, [0]*n
for i in range(n):
  x[i], y[i] = map(int, input().split())

def dist(a, b):
  dx = x[a] - x[b]
  dy = y[a] - y[b]
  return (dx**2 + dy**2)**0.5

ans = 0
np = [x for x in range(n)]
p = list(permutations(np))
for a in p:
  memo = 0
  for i in range(n-1):
    memo += dist(a[i],a[i+1])
  ans += memo
print(ans / len(p))

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

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/2;
    public static final int inf = Integer.MAX_VALUE/2;

    static void solve(InputReader in, PrintWriter out){
        char[] s = in.ns().toCharArray();
        int n = s.length;
        long[] u = new long[n+1], mod_count = new long[2019];
        u[n] = 0; mod_count[0] = 1;
        long dig = 10, ans = 0;
        for (int i = n-1; i >= 0; i--) {
            u[i] = (u[i+1]+(s[i]-'0')*dig)%2019;
            ans += mod_count[(int)u[i]];
            mod_count[(int)u[i]]++;
            dig *= 10;
            dig %= 2019;
        }
        out.println(ans);
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public double nd(){
            return Double.parseDouble(ns());
        }
        public char nc(){
            return ns().toCharArray()[0];
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

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

using namespace std;
using ll = long long;

const long long INF = 1LL << 60;
const int NMAX = 100000;
int main() {
    #ifdef MYLOCAL
        ifstream in("input.txt");
        cin.rdbuf(in.rdbuf());
    #endif

    int n; cin >> n;

    set<ll> coins;
    for(int i = 0; i < n; ++i){
        if(pow(6, i) <= n) coins.insert((pow(6, i)));
        if(pow(9, i) <= n) coins.insert((pow(9, i)));
    }

    ll dp[n + 1];
    fill(dp, dp + n + 1, INF);
    dp[0] = 0;
    for (int i = 1; i < n + 1; ++i) {
        for(auto it : coins){
            if( i - it >= 0){
                dp[i] = min(dp[i], dp[i - it] + 1);
            }
        }
    }

    cout << dp[n] << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define END '\n'
#define int long long
#define pb push_back
#define pii pair<int, int>
#define ff first
#define ss second
#define trace(x) cerr<<x<<END;
#define loop(i, a, b) for(int i = (a); i < (b); i++)
#define loopb(i, b, a) for(int i = (b); i > (a); --i) 
const int mod = 1e9+7;
const int mod1 = 998244353;
const int inf = 9223372036854775807ll;

void solve()
  {
   int cnt = 0;
   string s,t;
   cin>>s>>t;
   int n = s.size();
   loop(i,0,n)
    cnt += (s[i]!=t[i]);
  cout<<cnt;
  } 
signed main()
 {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0); 
     solve();
  //cerr<<END<<1.0*clock();
  return 0;
} 

Measured memory_bytes: 3792
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
int main() {
  int N,L,sum,i;
  sum=0;
  cin>>N>>L;
  if(L>=0){
  for(i=1;i<N;i++){
  sum=L+i+sum;
  }
  }else if((N+L)>0){
  for(i=0;i<N;i++){
  sum=sum+L+i;
  }
  }else{
  for(i=0;i<(N-1);i++){
    
  sum=sum+L+i;
  
  }
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
#include <climits>
#define ll long long
#define LIM 100000
using namespace std;
int main() {
  ll a, b, c;
  ll cnt = 3;
  cin >> a >> b >> c;
  if (a == b && b == c) {
    cout << 1 << endl;
  } else if (a == b || b == c || a == c) {
    cout << 2 << endl;
  } else {
    cout << 3 << endl;
  }
  return 0;
}


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

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<ll>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};

ll N, K;
vector<ll> A;

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

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

  cin >> N >> K;
  ll before = N;

  if (N%K == 0) cout << 0 << endl;
  else if (N%K>double(K)/2) {
    cout << abs(N%K-K) << endl;
  }else{
    cout << N << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.readline
import time
import math
import itertools as it
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

N, K = inpl()
A = inpl()
for i in range(K, N):
    if A[i] > A[i-K]:
        print('Yes')
    else:
        print('No')

# -----------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)


Measured memory_bytes: 31804
#include <bits/stdc++.h>
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x) {
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
#define FAIL {printf("No");exit(0);}
map<int,int> mp;
int main() {
	int x,n; rd(n);
	for(int i=1;i<=n;++i) rd(x),mp[x]++;
	if(mp.size()==1&&(mp.begin()->first)==0) {
		printf("Yes");
		exit(0);
	}
	if(n%3) FAIL;
	int t=n/3,sum=0;
	for(map<int,int>::iterator it=mp.begin();it!=mp.end();++it) {
		if((it->second)%t) FAIL;
		int x=(it->second)/t;
		if(x&1) sum^=it->first;
	}
	if(sum) FAIL;
	printf("Yes");
	return 0;
}

	


Measured memory_bytes: 3840
#include<bits/stdc++.h>
using namespace std;
vector<int> adj[1005];
int main()
{
	int n,m;cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		int x,y;
		cin>>x>>y;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	for(int i=1;i<=n;i++)
	{
		cout<<adj[i].size()<<"\n";
	}
}

Measured memory_bytes: 256
#ifdef Prateek
  #include "Prateek.h"
#else
  #include <bits/stdc++.h>
  using namespace std;
  #define debug(...) 42
#endif
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   string s;
   cin >> s;
   cout << s.substr(0,3);
   return 0;
}

Measured memory_bytes: 3652
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;
const int IINF = 1e9;
const ll INF = 1e18;
const int MOD = 1e9 + 7;

#define dump(x) cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl

void chmin(ll &a, ll b) {
  if (a > b) {
    a = b;
  }
}
void chmax(ll &a, ll b) {
  if (a < b) {
    a = b;
  }
}

int main() {
  string s;
  cin >> s;
  int acnt = 0;
  int bcnt = 0;
  for (auto c : s) {
    c == 'A' ? acnt++ : bcnt++;
  }

  if (acnt > 0 && bcnt > 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

public class Main{
	// ------------------------

	public static void main(String[] args) {
		MyScanner sc = new MyScanner();
		out = new PrintWriter(new BufferedOutputStream(System.out));
		// ------------------------
		int a=sc.nextInt(),b=sc.nextInt(),t=sc.nextInt(),x=a,ans=0;
		while(x<=t){
			ans+=b;
			x+=a;
		}
		System.out.println(ans);
		// ------------------------
		out.close();
	}
	//------------------------

	public static PrintWriter out;
	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		long nextLong() {
			return Long.parseLong(next());
		}
		double nextDouble() {
			return Double.parseDouble(next());
		}
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


Measured memory_bytes: 23252
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
string train;
int main(){
	int n;
	cin>>n;
	for(int i = 0;i < n;i++){
		map<string,int> ma;
		cin>>train;
		for(int i =0;i <=train.length();i++){//切り離す場所
			string ftrain =train.substr(0,i);
			string btrain =train.substr(i,train.length());
			string fbtrain =ftrain+btrain;
			string bftrain =btrain+ftrain;
			ma[fbtrain] += 1;
			ma[bftrain] += 1;
			//cout <<ftrain<<" "<<btrain<<endl;
			string ftmp =ftrain;
			string btmp =btrain;
			reverse(ftmp.begin(),ftmp.end());
			reverse(btmp.begin(),btmp.end());
			string rftrain =ftmp;
			string rbtrain =btmp;
			string rfrbtrain =rftrain+rbtrain;
			string rbrftrain =rbtrain +rftrain;
			string rfbtrain =rftrain+btrain;
			string brftrain =btrain +rftrain;
			string rbftrain =rbtrain +ftrain;
			string frbtrain =ftrain +rbtrain;
			ma[rbrftrain] =1;
			ma[rfrbtrain] =1;
			ma[rfbtrain] =1;
			ma[brftrain] =1;
			ma[rbftrain] =1;
			ma[frbtrain] =1;
		}
		cout <<ma.size()<<endl;
	}
	return 0;
}

Measured memory_bytes: 1304
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<iomanip>
using namespace std;

int main(){
    int a,b;
    char s;
    cin>>a>>s>>b;
    if(s=='+'){
        cout<<a+b<<endl;
    }
    else{
        cout<<a-b<<endl;
    }
    return 0;
}


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

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

void solve() {
  int x;
  cin >> x;
  if (x == 0) {
    cout << 1 << endl;
    return;
  }
  cout << 0 << endl;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);

  solve();
  return 0;
}


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

using namespace std;
using ll = long long int;

int main(){
    int N;
    cin>>N;
    vector<int> H(N);
    for(int i=0;i<N;i++) cin>>H[i];
    
    vector<ll> cost(N);
    cost[0]=0;
    cost[1]=abs(H[1]-H[0]);
    for(int i=2;i<N;i++){
        int val1,val2;
        val1=cost[i-2]+(ll)abs(H[i]-H[i-2]);
        val2=cost[i-1]+(ll)abs(H[i]-H[i-1]);
        if(val1>val2) cost[i]=val2;
        else cost[i]=val1;
    }
    cout<<cost[N-1]<<endl;
    
    return 0;
}




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

struct node{
  int key;
  int w;
  struct node *next;
};
typedef struct node * Nodepointer;

Nodepointer G[10001];
Nodepointer MakeNode(int key,int w,Nodepointer Node){
  Nodepointer n;
  n=(Nodepointer)malloc(sizeof(struct node));
  n->key = key;
  n->w = w;
  n->next = Node;
  return n;
}

void Insert(int s,int t,int u){
  Nodepointer Node;
  Node = MakeNode(t,u,G[s]->next);
  G[s]->next = Node;
}

int main()
{
  int i,j,n,w = 0,v,c,c1,v1;
  int color[10001],d[10001],pi[10001],min,ii;
  Nodepointer Node;

  scanf("%d",&n);

  for(i = 0;i < n;i++) G[i] = MakeNode(0,0,NULL);
  for(i = 0;i < n;i++){
    scanf("%d%d",&v,&c);
    for(j = 0;j < c;j++){
      scanf("%d%d",&v1,&c1);
      Insert(i,v1,c1);
    }
  }
  for(i = 0;i < n;i++){
    color[i] = 0;
    pi[i] = -1;
    d[i] = 10000001;
  }
  d[0] = 0;

  while(1){
    min = 10000001;
    for(i = 0;i<n;i++){
      if(color[i] != 2 && d[i] < min){
        min = d[i];
        ii = i;
      }
    }
    if(min == 10000001) break;
    color[ii] = 2;
    for(Node = G[ii];Node != NULL;Node = Node->next){
      if(color[Node->key] != 2 && (Node->w+d[ii]) < d[Node->key]){
	pi[Node->key] = ii;
	d[Node->key] = Node->w + d[ii];
	color[Node->key] = 1;
      }
    }
  }
  for(i = 0;i < n;i++) printf("%d %d\n",i,d[i]);

  return 0;
}



Measured memory_bytes: 17384
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less  
using namespace         std;
#define                 int long long
#define                 double long double
#define                 pb push_back
#define                 mp make_pair
#define st(arr,a)       memset(arr,a,sizeof arr)
#define                 nl cout<<endl
#define                 endl '\n'              
#define bitcount(x)     __builtin_popcountll(x)
const int MOD = 1000000007ll;
#define forn(i,a,b)     for(int i=a;i<=b;i++)
#define rfor(i,a,b)     for(int i=a;i>=b;i--)
#define all(x)          x.begin() , x.end()
#define pi pair<int,int>
#define X first
#define Y second
#define N 1014159
#define  vi vector<int>
#define  v  vector
#define die exit(0)
using namespace __gnu_pbds;  
typedef tree<int, null_type, less<int>, rb_tree_tag,  
            tree_order_statistics_node_update> oset; 
gp_hash_table<int, int> table;
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
struct chash {
    int operator()(int x) const { return x ^ RANDOM; }
};

int arr[N];
string s;
int n;
map<pi,int>dp;

int get(int idx,int tot)
{
	if(tot<0)return 0;
	if(idx == n+1)return tot == 0;
	
	int x = tot+1;
	int k = 0;
	if(x%2)
	{
		k = 1;
	}
	if(idx == n+1)return tot == 0;
	//int&ans = dp[idx][tot];
	if(dp[{idx,tot}])return dp[{idx,tot}];
	int ans = 0; 
	//
	int p = arr[idx]^k;

	if(p == 1)
	{
		ans = tot*get(idx+1,tot-1);
		ans%=MOD;
	}
	else ans = (get(idx+1,tot+1))%MOD;
	
	return dp[{idx,tot}]=ans;
}



void solve()
{
 	cin>>n;
 	//assert(n<2000);
 	int x = 1;
 	forn(i,1,n)
 	{
 		x = (x*i)%MOD;
 	}
 	n*=2;
 	cin>>s;
 	forn(i,0,n-1)
 	{
 		if(s[i]=='B')arr[i+1] = 1;
 	}

 	//forn(i,1,n)cout<<arr[i]<<" ";
 	//nl;

 //	st(dp,-1);
 	cout<<(get(1,0)*x)%MOD;
}


signed main() 
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
    int t = 1;
    //cin>>t;
    forn(i,1,t)
    {
        solve();
        nl;
    }



    return 0;

}

//       g++ -g c.cpp ; timeout 2s ./a.out

Measured memory_bytes: 30100
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s; cin >> s;
  int countC = 0; int indexC;
  for (int i = 2; i < (int) s.size() - 1; i++){
    if (s[i] == 'C') {
      countC++; indexC = i;
    }
  }
  if (s[0] == 'A' && countC == 1) {
    for (int i = 1; i < (int) s.size(); i++){
      if (i == indexC) continue;
      if (s[i] >= 'A' && s[i] <= 'Z') {
        cout << "WA" << endl;
        return 0;
      }
    }
    cout << "AC" << endl;
    return 0;
  } else {
    cout << "WA" << endl;
    return 0;
  }
  return 0;
}

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

using namespace std;

#define REP(var, n)  for (decltype(n) var = 0; var < (n); var++)
#define RREP(var, n)  for (auto var = n - 1; var != static_cast<decltype(var)>(-1); var--)
#define FOR(var, a, b)  for (auto var = (a); var < (b); var++)
#define RFOR(var, a, b)  for (auto var = b - 1; var != a; var--)

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

#define all(c) begin(c),end(c)

template<typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
    if (!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}


template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    return os << '(' << p.first << ',' << p.second << ')';
}

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


auto solve() {
    int H, W;
    cin >> H >> W;
    vector<string> fi(H);
    for (auto &&e:fi) cin >> e;

    vector<vector<bool>> vis(H, vector<bool>(W, false));

    function<pii(int, int)> dfs = [&](int r, int c) -> pii {
        vis[r][c] = true;
        int blk = 0, wht = 0;
        if (fi[r][c] == '#') blk++;
        else wht++;

        REP(i, 4) {
            int nr = r + dx[i];
            int nc = c + dy[i];

            if (0 <= nr && nr < H && 0 <= nc && nc < W) {
                if (!vis[nr][nc] && fi[r][c] != fi[nr][nc]) {
                    vis[nr][nc] = true;
                    auto r = dfs(nr, nc);
                    blk += r.first;
                    wht += r.second;
                }
            }
        }

        return make_pair(blk, wht);
    };

    ll res = 0;
    REP(r, H) {
        REP(c, W) {
            if (!vis[r][c]) {
                auto t = dfs(r, c);
                res += (ll)t.first * t.second;
            }
        }
    }

    return res;
}


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

    cout << solve() << endl;
//    solve();

    return 0;
}


Measured memory_bytes: 25472
#include <stdio.h>
#include <algorithm>
using namespace std;

struct oo{
    int a,b;
}s[200010];

int cmp(oo q,oo p)
{
    return q.b<p.b;
}

int main()
{
    int n;scanf("%d",&n);
    for (int i=0;i<n;i++)
        scanf("%d%d",&s[i].a,&s[i].b);
    long long tot=0;
    sort(s,s+n,cmp);
    for (int i=0;i<n;i++)
    {
        tot+=s[i].a;
        if (tot>s[i].b)
        {
            printf("No");return 0;
        }
    }
    printf("Yes\n");



}



Measured memory_bytes: 1664
N = gets.to_i
train = Array.new(N)
1.upto(N - 1) do |i|
  c, s, f = gets.split(' ').map(&:to_i)
  train[i] = [c, s, f]
end

1.upto(N) do |start|
  now = start
  time = 0
  while now < N
    c, s, f = train[now]
    if time <= s
      time = s + c
    else
      if time % f == 0
        time = time + c
      else
        time = (time + f) - (time % f) + c
      end
    end
    now += 1
  end
  puts time
end

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


using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll dp[100001];
    memset(dp,0,sizeof(dp));
    ll i;
    ll s=0;
    ll a[n];
    for(i=0;i<n;i++)
    {
    	cin>>a[i];
    	dp[a[i]]++;
    	s+=a[i];
	}
	ll q;
	cin>>q;
	for(i=0;i<q;i++)
	{
		ll e,f;
		cin>>e>>f;
		
	
		s=s-dp[e]*e+dp[e]*f;
		
		dp[f]+=dp[e];
		dp[e]=0;
		cout<<s<<endl;
	}
  return 0;
}


Measured memory_bytes: 5212
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
res=0
bk_a=-1
for i in range(n):
  res+=b[a[i]-1]
  if bk_a+1==a[i]:
    res+=c[bk_a-1]
  bk_a=a[i]
print(res)

Measured memory_bytes: 3064
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let a: usize = iter.next().unwrap().parse().unwrap();
    let b: usize = iter.next().unwrap().parse().unwrap();
    let t: usize = iter.next().unwrap().parse().unwrap();

    println!("{}", t/a * b);
}


Measured memory_bytes: 4352
#include <stdio.h>
int main(void){
    // Your code here!
	int w,h,x,y,r;
	scanf("%d", &w);
	scanf("%d", &h);
	scanf("%d", &x);
    scanf("%d", &y);
    scanf("%d", &r);
    
	if(w >= x + r && 0 <= x - r && h >= y + r && 0 <= y + r)
	    printf("Yes\n");
	else
	    printf("No\n");
	return 0;
}


Measured memory_bytes: 2104
#include<iostream>
#include <iomanip>
#include <ios>
#include <vector>
#include <string>
#include <algorithm>
#include <string>
#include<limits>
#include<cstdlib>
#include<functional>
#include<cassert>
#include <cstdio>
#include <stack>
#include <queue>
#include <map>
//#include <bits/stdc++.h>//atcoderでsqrtを使うときに必要
#define fi(p) for(int i=0;i<(p);i++)
#define ce(d) cout<<d<<endl;
#define ll long long
#define sorts(c) sort((c).begin(),(c).end());

using namespace std;

void solve() {
	ll n,k,res1,res2;
	res1 = 0;
	res2 = 0;
	cin >> k >> n;
	vector<ll> a(n);
	fi(n) {
		cin >> a[i];
	}
	ll max = k + a[0] - a[n - 1];
	fi(n-1) {
		ll len = a[i + 1] - a[i];
		res1 += len;
		if (len > max) {
			max = len;
		}
	}
	res1 += k + a[0] - a[n - 1];


	cout << res1-max << endl;
}

int main()
{
	solve();

	int a;//止める用
	cin >> a;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define pll pair<ll,ll>
#define forA(i,a,n,x) for(auto i=a;i<n;i+=x)
#define forD(i,a,n,x) for(auto i=n-1;i>=0;i-=x)
#define ranit(it,n) for(auto it:n)
#define testCases ll t;cin>>t;while(t--)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define init(a,x) memset(a,x,sizeof(a))

int main()
{
	ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
	ll d,s,t; cin>>d>>t>>s;
	double time = (d*1.0)/s;
	if(time<=(t*1.0))cout<<"Yes";
	else cout<<"No";
	//cout<<time;
	return 0;
}

Measured memory_bytes: 3688
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#define REP(i,n) for(int i=0;i<(n);i++)
#define EREP(i,x,n) for(int i=(x);i<(n);i++)
#define FOR(i,n) for(int i=1;i<(n);i++)
using namespace std;
int main(){
	long int n,a[100100],some1[100100],some2,max=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<100100;i++){
		some1[i]=0;
	}
	if(n==1){
		max=1;
	}
	else if(n==2){
		if(a[0]==a[1]){
			max=2;
		}
		else if(abs(a[0]-a[1])<=2){
			max=2;
		}
		else{
			max=1;
		}
	}
	else{
		for(int i=0;i<n;i++){
			some1[a[i]]++;
			some1[a[i]+1]++;
			some1[a[i]+2]++;
		}
		for(int i=0;i<100100;i++){
			if(max<some1[i]){
				max=some1[i];
			}
		}
	}
	cout<<max<<endl;
	return 0;
}

Measured memory_bytes: 1792
import java.util.*;

public class Main {

    long INF = Long.MAX_VALUE;
    long[] dp;
    long n;
    long S;
    int[] h;

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

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        dp = new long[N];
        h = new int[N];

        Arrays.fill(dp, Long.MAX_VALUE);
        dp[0] = 0;
        for (int i = 0; i < N; i++) {
            h[i] = sc.nextInt();
        }
        System.out.println(flog(N - 1));
    }

    long flog(int i) {
        if (dp[i] != Long.MAX_VALUE) {
            return dp[i];
        }
        if (i <= 0) {
            return 0;
        }
        if (i == 1) {
            return dp[i] = flog(i - 1) + Math.abs(h[i - 1] - h[i]);
        }
        return dp[i] = Math.min(flog(i - 1) + Math.abs(h[i - 1] - h[i]), flog(i - 2) + Math.abs(h[i - 2] - h[i]));
    }
}


Measured memory_bytes: 68012
N, M = map(int, input().split())
r = [[] * N for i in range(N)]
reached = [0] * N
reached[0] = 1
count = 0
 
def dfs(now):
    global count
    if all(reached):
        count += 1
    for next in r[now]:
        if reached[next] == 0:
            reached[next] = 1
            dfs(next)
            reached[next] = 0
 
for i in range(M):
    a, b = map(lambda x: int(x) - 1, input().split())
    r[a].append(b)
    r[b].append(a)
 
dfs(0)
 
print(count)

Measured memory_bytes: 3064
#include<stdio.h>
int main (void){
  int n,k,i,s,p,t,g=0,a[110]={0};
    scanf("%d %d",&n,&k);
  for(s=0;s<n;s++){  scanf("%d",&p);for(i=0;i<p;i++)  {scanf("%d",&t);a[t-1]=1;  }  }
  i=0;
  for(i=0;i<n;i++){  if(a[i]==0) g++ ; }
  printf("%d",g);
 return 0; 
}


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

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORTASC(c) sort((c).begin(),(c).end())
#define SORTDESC(c,t) sort((c).begin(),(c).end(), std::greater<t>());
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define VMAX(a) *max_element(ALL(a))
#define VMIN(a) *min_element(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double PI  = acos(-1.0);

using ll = long long;
using namespace std;

ll EuclideanAlgorithm (ll a, ll b);

ll EuclideanAlgorithm (ll a, ll b) {
    if (b == 0) {
        return a;
    } else {
        return EuclideanAlgorithm(b, a%b);
    }
}

int main() {
    ll a, b;

    cin >> a >> b;

    ll gcd = EuclideanAlgorithm(a, b);
    ll lcm = a*b / gcd;

    cout << lcm << endl;

    return 0;
}

Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as BS
import Data.Maybe (fromJust)
import Data.List
import Control.Monad

data Rgb = Rgb {red :: Int, green :: Int, blue :: Int}

toYesNo :: Bool -> String
toYesNo True = "YES"
toYesNo _ = "NO"

toNum :: Rgb -> Int
toNum rgb = (red rgb) * 100 + (green rgb) * 10 + (blue rgb)

solve :: Rgb -> String
solve = toYesNo . ((==) 0) . (flip mod 4) . toNum

main :: IO ()
main = do
    [r, g, b] <- map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
    let rgb = Rgb {red=r, green=g, blue=b}
    putStrLn $ solve rgb


Measured memory_bytes: 380
/*                          /
/      2014.08.26           /
/                          */

//真っ白な紙にインクを垂らしインク絵汚れていない部分の数を出力し、汚れる回数が多いエリアを出力する。
//落とすインク液は少しならば１、中ぐらいなら２、多いならば３とする。
#include<stdio.h>

void littleDrop(int,int,int *,int);
void midiumDrop(int,int *,int,int);
void largeDrop(int,int *,int);
void showArray(int [][10]);

void largeDrop(int center,int *tbl,int place){
	if(center >= 20)//二つ上に配列があるか確認
		*(tbl - 20) += 1;
	if(place >= 2)//二つ左に配列があるか確認
		*(tbl - 2) += 1;
	if(place <= 7)//二つ右に配列があるか確認
		*(tbl + 2) += 1;
	if(center <= 80)//二つ下に配列がある確認
		*(tbl + 20) += 1;
}

void midiumDrop(int center,int *tbl ,int size, int place){
//右上、右下、左上、左下に+1//
	if(center > 10){//上に配列がある
		if(place != 0)//左に配列があるか確認
			*(tbl - 11) += 1;
		if(place != 9)//右に配列があるか確認
			*(tbl - 9) += 1;
	}
	if(center < 90){//下に配列がある
		if(place != 0)//左に配列があるか確認
			*(tbl + 9) += 1;
		if(place != 9)//右に配列があるか確認
			*(tbl + 11) += 1;
	}
	if(size == 3)
		largeDrop(center,tbl,place);
}

void littleDrop(int x ,int y ,int *tbl,int size){
//インクを落とす場所は左上(0,0)から何番目かを求める。
	int center = x + y * 10;
	int place = center % 10;//左、右に配列があるか確認するときに使用
//(0,0)からインクの落下位置へと移動させる
	tbl = (tbl + center);

//真ん中に+1
	*(tbl) += 1;
//上に+1
	if(center >= 10)//centerが最上列でない
		*(tbl - 10) += 1;
	if(center <= 90)//centerが最下列でない
		*(tbl + 10) += 1;
	if(place != 0)//centerが左側でない
		*(tbl - 1) += 1;
	if(place != 9)//centerが右側でない
		*(tbl + 1) += 1;
	if(size >= 2)
		midiumDrop(center, tbl, size,place);
}

void showArray(int in[10][10]){
	int i,j;
	for(i = 0 ; i < 10 ;i ++){
		for(j = 0; j < 10; j ++){
			printf("%d ",in[i][j]);
		}
		printf("\n");
	}
}


int main(void){
	int i,j,clear,max;
	int x,y,size;
	int tbl[10][10] = {0};

	while(scanf("%d,%d,%d",&x ,&y ,&size) != EOF){
		getchar();//バッファに\nがたまるのを防ぐ
		if(size <= 3 && x <= 9 && y <= 9)
			littleDrop(x,y,*tbl,size);
		//showArray(tbl);
	}

	for(i = 0, clear = 0, max = 0; i < 10 ;i ++){
		for(j = 0; j < 10; j ++){
			//printf("%d ",tbl[i][j]);//確認用
			if(tbl[i][j] == 0)
				clear ++;
			else if(tbl[i][j] > max)
				max = tbl[i][j];
		}
		//printf("\n");//上の確認用と連動
	}
	printf("%d\n",clear);//インクが落ちていない個所の合計
	printf("%d\n",max);//一番多くインクが落ちた量

	return 0;
}

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

int w,h;
string data[50];
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};
int ans;

void solve(int y, int x){

  if(y < 0 || x < 0 || y == h || x == w) return;
  if(data[y][x] == '#') return;

  data[y][x] = '#';
  ans++;

  for(int i=0;i<4;i++) solve(y+dy[i], x+dx[i]);
}

int main(){

  while(true){
    cin >> w >> h;
    if(!w && !h) break;

    for(int i=0;i<h;i++) cin >> data[i];

    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	if(data[i][j] == '@') ans = 0, solve(i, j); //y,x
      }
    }

    cout << ans << endl;

  }
}

Measured memory_bytes: 1212
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();
        if(a+b >= 10){
            System.out.print("error");

        }else{
            System.out.print(a + b);
        }
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
 
typedef double db;
typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const ll MOD = 1e9+7;
const double PI  = 3.14159265358;
const double EPS = 1e-8;

#define INT_MX 2147483647
#define INF ((int)1e9)
#define LLINF ((ll)1e18)
#define F first
#define S second
#define MP(x,y) make_pair(x,y)
#define siz(v) ((int)v.size())
#define rs(n) resize(n)
#define ALL(v) v.begin(),v.end()
#define reset(v) memset((v),0,sizeof(v))
#define EB emplace_back
#define PB push_back
#define PF push_front
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,a,b) for(int i=(a);i<(b);i++) 
#define vec vector
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

void solve(){
	int n;
	
	cin >> n;
	vec<int> v(n);
	
	rep(i, n)	cin >> v[i];
	
	int ans = INF, res;
	rep1(i, 100){
		res = 0;
		for(auto j:v)	res += (j - i)*(j - i);
		ans = min(ans, res);
	}
	
	cout <<ans << '\n';
}

int main(){
	int T = 1;
	
	while(T--){
		solve();
	}
}




Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <map>
#include <cmath>
using namespace std;
int main(){
    int w,h;
    int n;
    cin>>h>>w>>n;
    int m=max(h,w);
    cout<<(n-1)/m+1<<endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = [[int(a),"A"] for a in input().split()]
B = [[int(b),"B"] for b in input().split()]
C = [[int(c),"C"] for c in input().split()]

parts = A+B+C
parts.sort(reverse = True,key = lambda x:x[0])

A_count = 0  
B_count = 0  
C_count = 0

for s,t in parts:
    if t=="C":      
        C_count += 1
    elif t=="B":
        B_count += C_count             
    elif t=="A":
        A_count += B_count
print(A_count)  

Measured memory_bytes: 53744
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int N; cin >> N;
    vector<int> A(N + 2);
    REP(i, 0, N) cin >> A[i + 1];
    A[0] = 0; A[N + 1] = 0;

    int total = 0;
    REP(i, 1, A.size()) {
        total += abs(A[i - 1] - A[i]);
    }

    vector<int> diff(N);
    REP(i, 0, N) {
        diff[i] = abs(A[i + 2] - A[i + 1]) + abs(A[i + 1] - A[i]) - abs(A[i + 2] - A[i]);
        cout << total - diff[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 2048
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll first(ll n)
{
	ll f;
	while(n)
	{
		f = n%10;
		n/=10;
	}
	return f;
}
ll last(ll n)
{
	ll l = n%10;
	
	return l;
}
int main()
{
	ll n;
	cin>>n;
	map<pair<ll,ll>,ll>mp;
	for(ll i=1;i<=n;i++)
	{
		ll ld,fd;
		if(i<=9)
		{
			ld = i;
			fd = i;
		}
		else
		{
			 fd = first(i);
		     ld = last(i);
		}
		mp[{fd,ld}]++;
	}
	ll ans = 0;
	for(ll i=0;i<=9;i++)
	{
		for(ll j=0;j<=9;j++)
		{
			ans += mp[{i,j}]*mp[{j,i}];
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

string S;
int N;


int main(void)
{
	cin >> S;
	N = S.size();
	map<int, vector<int>>mp;//インデックス
	vector<int>vec;//ハッシュ
	map<int, int>small;//そのハッシュの最小dp値
	int has = 0;
	mp[has].push_back(0);
	vec.push_back(has);
	int i = 0;
	for (char c : S) {
		++i;
		has ^= (1 << (c - 'a'));
		mp[has].push_back(i);
		vec.push_back(has);
	}
	vector<int>dp(N + 1);
	small[0] = 0;
	for (int x = 1; x <= N; ++x) {
		int maybe = dp[x - 1];
		if (small.count(vec[x])) {
			maybe = min(maybe, small[vec[x]]);
		}
		for (int al = 0; al < 26; ++al) {
			if (small.count(vec[x] ^ (1 << al))) {
				maybe = min(maybe, small[vec[x] ^ (1 << al)]);
			}
		}
		dp[x] = maybe + 1;
		if (!small.count(vec[x]))
			small[vec[x]] = dp[x];
		else
			small[vec[x]] = min(small[vec[x]], dp[x]);
	}
	cout << max(dp[N], 1) << endl;
	return 0;
}


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

int main(){
  int r, c;
  cin >> r >> c;
  int X[r+1][c+1];
  for (int i=0; i<=r; ++i){
    int sum=0;
    for (int j=0; j<=c; ++j){
      if (i==r) X[i][j] = 0;
      else if (j==c) X[i][j] = sum;
      else{
	cin >> X[i][j];
	sum += X[i][j];
      }
    }
  }
  for (int j=0; j<c; ++j){
    for (int i=0; i<r; ++i){
      X[r][j] += X[i][j];
    }
  }
  for (int j=0; j<c; ++j){
    X[r][c] += X[r][j];
  }
  for (int i=0; i<=r; ++i){
    for (int j=0; j<=c ; ++j){
      if (j==c) cout << X[i][j] << endl;
      else cout << X[i][j] << " ";
    }
  }
  return 0;
}

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

#define ll long long

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int k, x;
    cin >> k >> x;

    for(int i = x - (k - 1); i <= x + (k -1); i++){
        cout << i << " ";
    }

    return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"

//region Template
#include "ext/pb_ds/assoc_container.hpp"

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const int MOD = 1000000007;
using namespace std;
#define finish(x) cout << x; exit(0);
#define fastIO cin.tie(0); cin.sync_with_stdio(false);
#define endl '\n'

void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }

//const string USCAO_TAG = "mountains";
void usaco(const string& USACO_TAG) { setIn(USACO_TAG + ".in"); setOut(USACO_TAG + ".out"); }
void print() {}
template<typename T, typename... Args>
void print(T firstArg, Args... args) {
	#ifdef LOCAL
	cout << firstArg << " ";
	print(args...);
	#endif
}
//endregion

/* Notes:
 * Farah </3
 */

const int MAXN = 1e6 + 5;
const int INF = 2e9;
int freq[MAXN];

int main() {
	//usaco("milkvisits");

	#ifdef LOCAL
	setIn("in.txt");
	setOut("out.txt");
	#endif

	int n;
	cin >> n;

	ll a[n], b[n];

	ll k;
	cin >> k;


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

	for(int i = 0; i < n; i++){
		cin >> b[i];
	}
	sort(b, b + n, greater<int>());
	sort(a, a + n);

	ll l = 0, r = 1e18;
	ll ans = 2e18;
	while(l <= r){
		ll m = (l + r) / 2;

		ll need = 0;
		for(int i = 0; i < n; i++){
			ll y = max(0ll, a[i] - (m / b[i]));

			need += y + ((a[i] - y) * b[i] > m);
		}

		if(need > k){
			l = m + 1;
		}
		else {
			r = m - 1;
			ans = m;
		}
	}

	cout << ans;
	return 0;
}

Measured memory_bytes: 3456