akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static AtCoderTemplate.MyLibrary;

namespace AtCoderTemplate
{
    class Program
    {
        static void Main (string[] args)
        {
            string[] str;
            str = Console.ReadLine ().Split (' ');

            int L = int.Parse (str[0]);
            int R = int.Parse (str[1]);
            int d = int.Parse (str[2]);

            Console.Write (R / d - (L - 1) / d);
        }
    }

    class MyLibrary
    {
        public static int GCD (int a, int b)
        {
            if (a % b == 0) return b;
            return GCD (b, a % b);
        }
    }
}

Measured memory_bytes: 27240
#include "bits/stdc++.h"
/* Properties of modulo:
	(a/b)%m ,where m is prime  = (a%m) * (b^(m-2))%m
*/
    /*ROLLING HASH
    Rabin-Karp algorithm for pattern matching in a string in O(n) time
    Calculating the number of different substrings of a string in O(n2logn)
    Calculating the number of palindromic substrings in a string.
    */
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define ll long long
#define pb push_back
#define nl cout<<"\n"
#define endl "\n"
#define all(c) (c).begin(),(c).end()
#define trav(a,x) for(auto a = x.begin() ; a != x.end() ; a++)
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
//template<typename T>
//#define o_set(T) tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
// o_set(ll) name ; -- defining ordered set
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : counting from zero it returns the k-th largest or smallest element in the set - returns iterator
bool compare(ll a, ll b){
    return a > b;
}
inline ll max(ll a,ll b)
{return ((a>b)?a:b);}
inline ll min(ll a,ll b)
{return ((a>b)?b:a);}
inline ll gcd(ll a ,ll b)
{if(b==0) return a;a%=b;return gcd(b,a);}
ll power(ll x, ll ex , ll md) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % md;
        ex >>= 1ll;
        x = (x * x) % md;
    }
    return ans;
}
void solve(){
    string s1;
    string s2;
    cin >> s1;
    cin >>s2;
    ll l1= s1.size();
    ll l2 = s2.size();
    if(l2 <= l1) cout<<"No\n";
    else if(l2 > l1 + 1) cout<<"No\n";
    else{
        ll ct =0 ;
        for(ll i = 0 ; i < l1 ; i++) if(s1[i] == s2[i]) ct++;
            if(ct == l1 ) cout<<"Yes\n";
        else cout <<"No\n";
    }
}
int main(){
    IOS;
    ll T=1;
    //cin>>T;
    ll t=0;
    while(t++<T){
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 3844
#include <bits/stdc++.h>
#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 inf 9999999999;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define pb push_back
#define f first
#define s second
#define pi 3.141592653589793238
using namespace std;

int main()
{
	std::ios::sync_with_stdio(false);
	
	ll n;
	cin >> n;
	ll t[n+2];
	for(int i =1;i<=n;i++) cin >> t[i];
	ll m;
	cin >> m;

	vector<pll> v;
	for(int i =1;i<=m;i++)
	{
		ll p,x;
		cin >> p >> x;
		v.pb(mp(p,x));
	}

	for(int i =0;i<v.size();i++)
	{
		ll ans = 0;
		for(int j = 1;j<=n;j++)
		{
			if(j==v[i].f) ans+=v[i].s;
			else ans+=t[j];
		}
		cout << ans << endl;
	}




	return 0;
}



Measured memory_bytes: 256
/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                       O\  =  /O
                    ____/`---'\____
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <bitset>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <chrono>
#include <random>

using namespace std;

using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define printn(v) rep(i, (v).size() - 1) cout << (v)[i] << ' '; cout << (v)[n - 1] << '\n';
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define debug2(x, y) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;

template<typename T> T gcd(T a, T b) {
    if (a < b) return gcd(b, a);
    T r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

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

template<typename T> bool chmin(T& a, const T& b) {
    if (a > b) return a = b, true; else return false;
}

template<typename T> bool chmax(T& a, const T& b) {
    if (a < b) return a = b, true; else return false;
}

// End of template.

int main() {
    cout << fixed << setprecision(15);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // cin.read(buf, sizeof buf); // 注意: ./a.out < in か pbp | ./a.out で入力すること

    int n, a[200200];
    cin >> n;
    rep(i, n) cin >> a[i];
    sort(begin(a), begin(a) + n);
    bool ans = false;
    rep(i, n - 1) ans |= a[i] == a[i + 1];
    if (!ans) print("YES"); else print("NO");

    return 0;
}



Measured memory_bytes: 1024
#include <stdio.h>
#include <bitset>
using namespace std;
bitset <10000> bit[10];
int main()
{
    int r, c;
    while(scanf("%d%d", &r, &c), r || c)
    {
        int i, j, k;
        for(i = 0; i < r; i++)
            for(j = 0; j < c; j++)
            {
                int x;
                scanf("%d", &x);
                bit[i][j] = x;
            }
        // 用二?制枚?行数是否翻?
        int ans = 0;
        for(i = 0;i < (1 << r);i++)
        {
            //枚??一行是否翻?
            for(j = 0;j < r;j++)
            {
                if(i & (1 << j))
                    bit[j].flip();
            }

            int t = 0;
            for(j = 0;j < c;j++)
            {
                int tt = 0;
                for(k = 0;k < r;k++)
                    if(bit[k].test(j))
                        tt++;
                t += max(tt, r - tt);
            }
            ans = max(ans, t);

            //回溯
            for(j = 0;j < r;j++)
            {
                if(i & (1 << j))
                    bit[j].flip();
            }
        }
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 1040
from math import exp
from math import log

n = int(input())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
Z = [abs(X[i] - Y[i]) for i in range(n)]
D1 = sum(Z)
try:
    D2 = exp((1 / 2) * log(sum((Z[i] ** 2) for i in range(n))))
    D3 = exp((1 / 3) * log(sum((Z[i] ** 3) for i in range(n))))
except ValueError:
    D2 = 0
    D3 = 0
Di = max(Z)
print("{:.5f}".format(D1))
print("{:.5f}".format(D2))
print("{:.5f}".format(D3))
print("{:.5f}".format(Di))

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

int main(){
        int i,ans,ia,ib=0;
        ll n,m,k,A,B;
        cin >> n >> m >> k;
        vector<ll> a(n+1);
        vector<ll> b(m+1);
        for(i=1;i<n+1;++i){
                cin >> A;
                a.at(i) = a.at(i-1)+A;
        }
        for(i=1;i<m+1;++i){
                cin >> B;
                b.at(i) = b.at(i-1)+B;
        }
        for(i=n;i>=0;--i){
                if(a.at(i)<=k){
                        ans = i;
                        ia = i;
                        break;
                }
        }
        while(ia>=0){
                while(a.at(ia)+b.at(ib)<=k){
                        ++ib;
                        if(ib>m) break;
                }
                --ib;
                ans = max(ans, ia+ib);
                --ia;
        }
        cout << ans << endl;
        return 0;
}

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

using namespace std;

#define ll long long

ll gcd(ll a, ll b){
  if(a < b) swap(a, b);
  
  ll r = a % b;
  if(r == 0) return b;
  else return gcd(b, r);
}

int main(){
  ll a, b;
  cin >> a >> b;
  
  ll g = gcd(a, b);
  
  ll count = 1;
  ll h = g;
  for(ll i = 2; i * i <= h; i++){
    if(g % i != 0) continue;
    count++;
    while(g % i == 0){
      g /= i;
    }
    if(g == 1) break;
  }
  if(g != 1) count++;
  
  cout << count << '\n';
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pll = pair<ll, ll>;
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define sz(x) ((x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
const double PI = acos(-1);
const int mod = 1e9+7;
const long long INF = (1LL << 60);
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(ll a, ll b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmax(T &a, const T &b){ if(a < b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(a > b){ a=b; return 1; } return 0; }

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

  ll n;
  cin >> n;
  vector<ll> a(n, 0);
  ll sum = 0;
  for(ll i = 0; i < n; i++){
    cin >> a[i];
    a[i] *= 2;
    sum = a[i] - sum;
  }
  sum /= 2;

  rep(i, 0, n){
    cout << sum << ' ';
    sum = a[i] - sum;
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 2176
import scala.annotation.tailrec
import scala.collection.mutable

object Main extends App {
  import scala.io.StdIn._
  loop()
  @tailrec def loop(): Unit = {
    val n = readInt()
    if (n == 0) return
    val balloons = Array.fill(n){
      val Array(p, t) = readLine.trim.split(' ').map(_.toInt)
      Balloon(p, t)
    }
    val memo = Array.fill(n){Array.fill(4){None: Option[Result]}}
    search(0, VehicleState(0, 0, 0, 0))(balloons, memo) match {
      case Success(len) ⇒
        println(s"OK $len")
      case Fail(pos) ⇒
        println(s"NG ${pos + 1}")
    }
    loop()
  }
  case class Balloon(position: Int, time: Int)
  def search(count: Int, vehicle: VehicleState)(implicit balloons: Array[Balloon], memo: Array[Array[Option[Result]]]): Result = {
    if (count == balloons.length) return Success(vehicle.position)
    memo(count)(vehicle.balloonCount) match {
      case Some(e) ⇒ e
      case None ⇒
        val res = vehicle.move(balloons(count)).map(v ⇒ search(count + 1, v).mapSuccess(_ + v.prevMove)).getOrElse(Fail(count)).accumulate(vehicle.moveWithRelayToHouse(balloons(count)).map(v ⇒ search(count + 1, v).mapSuccess(_ + v.prevMove)).getOrElse(Fail(count)))
        memo(count)(vehicle.balloonCount) = Some(res)
        res
    }
  }
  case class VehicleState(position: Int, time: Int, balloonCount: Int, prevMove: Int) {
    def move(to: Balloon): Option[VehicleState] = {
      //System.err.println(s"expected ${to.time}, actual ${math.abs(position - to.position) * (balloonCount + 1) + time}")
      if (balloonCount < 3 && to.time >= math.abs(position - to.position) * (balloonCount + 1) + time) Some(VehicleState(to.position, to.time, balloonCount + 1, math.abs(position - to.position)))
      else None
    }
    def moveWithRelayToHouse(to: Balloon): Option[VehicleState] = {
      //System.err.println(s"Relay expected ${to.time}, actual ${to.position + position * (balloonCount + 1) + time}")
      if (to.time >= to.position + position * (balloonCount + 1) + time) Some(VehicleState(to.position, to.time, 1, to.position + position))
      else None
    }
  }
  sealed trait Result {
    def accumulate(result: Result): Result
    def mapSuccess(func: Int ⇒ Int): Result = this
  }
  case class Success(length: Int) extends Result {
    override def accumulate(result: Result): Result = {
      result match {
        case Success(r) ⇒ Success(math.min(length, r))
        case Fail(_) ⇒ this
      }
    }
    override def mapSuccess(func: Int ⇒ Int): Result = Success(func(length))
  }
  case class Fail(failPosition: Int) extends Result {
    override def accumulate(result: Result): Result = {
      result match  {
        case Fail(f) ⇒ Fail(math.max(failPosition, f))
        case Success(_) ⇒ result
      }
    }
  }
}


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

int main()
{
    int N, A[210], ans = 0;
    cin >> N;
    REP(i, N) cin >> A[i];
    bool is_continue = true;
    while(is_continue)
    {
        REP(i, N)
        {
            if (A[i] % 2 != 0)
            {
                is_continue = false;
                break;
            }
            else
            {
                A[i] /= 2;
            }
        }
        if (is_continue == true) ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,wt;
  cin>>n>>wt;
  int* w=new int[n];
  int* v=new int[n];
  for(int i=0;i<n;i++)
    cin>>w[i]>>v[i];
  
  for(int i=0;i<n-1;i++)
  {
    int m=i;
    for(int j=i+1;j<n;j++)
    {
      if(w[m]>w[j])
        m=j;
    }
    if(m!=i)
    {swap(w[m],w[i]);
     swap(v[m],v[i]);}
  }
  long long dp[n+1][wt+1];
  for(int i=0;i<=n;i++)
  {dp[i][0]=0;}
    for(int i=1;i<=wt;i++)
    dp[0][i]=0;
  long long m=0;
  for(int i=1;i<=n;i++)
  {
    int t=w[i-1];
    for(int j=0;j<t;j++)
    {dp[i][j]=dp[i-1][j];}
    for(int j=t;j<=wt;j++)
    {dp[i][j]=max(dp[i-1][j],v[i-1]+dp[i-1][j-t]);
     
     if(m<dp[i][j])
       m=dp[i][j];
    }
  }
  cout<<m;
  return 0;
}
  


Measured memory_bytes: 79104
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define all(a) (a).begin(), (a).end()


int main(){
    string s;
    cin >> s;
    if(s[2] == s[3] and s[4] == s[5]) puts("Yes");
    else puts("No");
}


Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long

int main()
{
    fastio;
    ll i, j, t, k, n, p, q, d;
    cin>>k>>n;
    ll a[n], b[n];
    for(i=0;i<n;i++){
        cin>>a[i];
        b[i]=a[i];
    }
    ll md=0, mdi=0, sum=0;
    for(i=1;i<n;i++)
    {
        if(a[i]-a[i-1]>md)
        {
            mdi=i;
            md=a[i]-a[i-1];
        }
    }
    if(md>k+a[0]-a[n-1])
    {
        for(i=0;i<n;i++)
        {
            if(i<mdi) b[i+n-mdi]=a[i];
            else b[i-mdi]=a[i];
        }
    }
    for(i=1;i<n;i++)
    {
        d=b[i]-b[i-1];
        if(d<0) d=k+b[i]-b[i-1];
        sum+=d;
    }
    cout<<sum;
}


Measured memory_bytes: 3328
n, k = map(int, input().split())
s = input()
l = []
flg = (0 if s[0] == 'L' else 1)
cnt = 0
for c in s:
    if flg == 1 and c == 'L':
        flg = 0
        l.append(cnt)
        cnt = 0
    elif flg == 0 and c == 'R':
        flg = 1
        l.append(cnt)
        cnt = 0
    cnt += 1
l.append(cnt)
y = (0 if len(l) % 2 else 1)
x = len(l) // 2 - y
if x + y <= k:
    ans1 = x * 2 + y
elif x <= k:
    ans1 = x * 2 + (k - x)
else:
    ans1 = k * 2
ans1 += sum(l) - len(l)
y = (2 if len(l) % 2 else 1)
x = len(l) // 2 + (1 if len(l) % 2 else 0) - y
if x + y <= k:
    ans2 = x * 2 + y
elif x <= k:
    ans2 = x * 2 + (k - x)
else:
    ans2 = k * 2
ans2 += sum(l) - len(l)

print(max(ans1, ans2))


Measured memory_bytes: 4220
// Author: Mrigank
// Science is what we understand well enough to explain to a computer, Art is everything else we do - Donald E. Knuth
#include <bits/stdc++.h>
#include <iostream>
#include <unordered_map>
#include <map>
#include <queue>
#include <stack>
#include <unordered_set>
#include <set>
#include <string> 
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

typedef long long int ll;
typedef long double ld;
typedef pair<ll, int> PLI;
typedef pair<int, int> PII;
typedef vector < ll > vl;
typedef vector < int > vi;
typedef vector < bool > vb;
typedef vector < pair < ll , ll > > vpl;
typedef vector < pair < ll , bool > > vpb;
typedef vector < vector < int > > vvi;
typedef vector < vector < ll > > vvl;


#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define pi pair < ll , ll >
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define clr(x , val) memset(x , val , sizeof(x))
#define deb1(x) cout << x << endl
#define deb2(x , y) cout << x << " " << y << endl
#define deb3(x , y , z) cout << x << " " << y << " " << z << endl
#define all(x) x.begin() , x.end()
#define alls(x , y) x.begin() , x.end() , y
#define fastIO                                                                 \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);


const ll mxsize = 5e6 + 5;
const ll linf = 1e9;
const ld inf = 10000000000.0;
const ll mod = 1e9 + 7;
 
/******************************************** CODE STARTS FROM HERE *************************************************/ 

int main()
{
    ll n;
    cin >> n;
    ll i;
    ll sum = 0;
    Fo(i , 1 , n + 1)
    {
        if(i % 3 == 0 || i % 5 == 0) continue;
        else sum += i;
    }
    cout << sum << endl;
}

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

int main(){
  map<int,int> m;
  int N;
  cin >> N;
  rep(i, N){
    int a;
    cin >> a;
    m[a]++;
  }
  int ans = 0;
  for(auto x : m){
    if(x.second >= x.first) ans += (x.second - x.first);
    else ans += x.second;
  }
  cout << ans << endl;
  return 0;
}


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

  string S ;
  int ans = 0 ;
  cin >> S  ;
  rep(i,S.size()){
    if(S.at(i) =='9') cout << 1 ;
    else cout << 9 ;
  }
  
}

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

int main()
{
  string s, t;

  cin >> s >> t;
  int res = s.compare(0, s.size(), t, 0, s.size());
  if (res == 0)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}

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

//struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))
//#define int long long

signed main(){
    int n; cin >> n;
    vector<int> ans(n,0);
    rep(i,n-1){
        int a; cin >> a;
        a--;
        ans[a]++;
    }
    for(int i: ans){
        cout << i << endl;
    }
}

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

int main() {
	int n;
	int x[20];
	int y[20] = {};
	cin >> n;

	for (int i = 0;i < n;i++) {
		int a, v;
		cin >> a >> v;
		x[a - 1] = v;
		y[a - 1] = x[a - 1];
	}
	sort(y, y + n);
	for (int i = 0;i < 20;i++) {
		if (y[n-1] == x[i]) {
			cout << (i + 1) << ' ' << x[i] << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 3132
#include <stdio.h>
#define MAX_N (105)

static
void 
bubbleSort( int A[], int N )
{
    int i, j;
    int count = 0;
    for ( i = 0; i < N; i++ ) {
	int flag = 0;
	for ( j = N-1; j > i; j-- ) {
	    if ( A[j-1] > A[j] ) {
		int tmp = A[j-1];
		A[j-1] = A[j];
		A[j] = tmp;
		flag = 1;
		count++;
	    }
	}
	if ( !flag ) {
	    break;
	}
    }
    
    for ( i = 0; i < N; i++ ) {
	printf("%d%c", A[i], (i == N - 1) ? '\n' : ' ');
    }
    
    printf("%d\n", count);
    return;
}

int main()
{
    int i;
    int N;
    int A[MAX_N];
    scanf("%d", &N);

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

    bubbleSort( A, N );

    return 0;
}

Measured memory_bytes: 1032
#define rep(i,a,b) for(int i=a;i<b;++i)
#define repr(i,a,b) for(int i=a,i > b;--i)
#define mm(lamb, tttt) memset(lamb, tttt, sizeof lamb)

#define null NULL
#define eps 0.000000001
#define mod 1000000007
#define PI 3.14159265358979323846
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define sz(V) (ll)V.size()
#define _ <<" "<<

#include <iostream>
#include <fstream>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <iterator>
#include <bitset>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <limits.h>
#include <iomanip>
#include <cctype>
#include <numeric>
#include <complex>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef pair <int, int> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<int> vii;

int board[101][101];

void print(bool swaped){
	for(int i=1;i<=100;i++){
		for(int j=1;j<=100;j++){
			if(board[i][j]==0){
				if(swaped) cout<<'.';
				else cout<<'#';	
			}
			else{
				if(swaped) cout<<'#';
				else cout<<'.';	
			}
		}cout<<endl;
	}
}

int main(){
	int A,B;
	cin>>A>>B;
	bool swaped=0;
	if(B > A){swaped=1;swap(B,A);}
	int exc=A-(B); // after this plant B-1 equal components by default is black
	
	int row=1;
	
		for(int i=1;i<=100 && exc;i+=2){
			row=i;
			for(int j=1;j<=100 && exc;j+=2) {board[i][j]=1;exc--;}  // 1 means white
		}
		row+=2;
		rep(i,1,101) board[row][i]=1;
		row++;
	
	exc=B-1;
	// if(exc < 50)
	// for(int i=row;exc;i+=2){exc--;
	// 	for(int j=1;j<=100;j++) board[i][j]=1; // alternate between white amd black
	//}

	
		while(exc >= 50){
			exc-=50;
			int cnt=49;row++;
			for(int i=1;i<=2*cnt;i+=2){
				board[row][i]=1;
			}row++;
			for(int i=2;i<=2*cnt;i+=2){
				board[row][i]=1;
			}board[row][99]=1;board[row][100]=1;
			row++;
			for(int i=1;i<=100;i++) board[row][i]=1;
			row++;	
		}
		int cnt=exc-1;if(exc) row++;
		
		for(int i=1;i<=2*cnt;i+=2){
				board[row][i]=1;
			}if(exc)row++;
		for(int i=2;i<=2*cnt;i+=2){
				board[row][i]=1;
		}
		for(int i=2*cnt+1;i<=100;i++) board[row][i]=1;
		row++;
		while(row<=100) {for(int i=1;i<=100;i++) board[row][i]=1; row++;}
		
	
	cout<<100<<" "<<100<<endl;
	print(swaped);
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int n, i, tmp, k;
    vector<int> d;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> tmp;
        d.push_back(tmp);
    }
    sort(d.begin(), d.end());
    k = abs(d[n/2] - d[n/2 -1]);
    cout << k << endl;
}

Measured memory_bytes: 892
#include<iostream>
using namespace std;
int A,B,C,D;
int main(void){
	cin>>A>>B>>C>>D;
	if(A+B>C+D)cout<<"Left";
	if(A+B<C+D)cout<<"Right";
	if(A+B==C+D)cout<<"Balanced";
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    // Your code here!
    int x,y;
    while(1){
    scanf("%d %d", &x, &y);
    if(x ==0 && y== 0)break;
    if ( x == 0 && y == 0 ) break;  
    if ( x<y ){
    printf("%d %d\n",x,y);
        } else {
    printf("%d %d\n",y,x);
    }
    }
}



Measured memory_bytes: 2040
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[5];
        for(int i=0; i<5; i++) {
            a[i] = Integer.parseInt(sc.next());
        }
        int k = Integer.parseInt(sc.next());
        
        String ans = "Yay!";
        for(int i=0; i<4; i++) {
            for(int j=i+1; j<5; j++) {
                if(a[j]-a[i] > k) {
                    ans = ":(";
                    break;
                }
            }
        }
        System.out.println(ans);
    }
}

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

int main()
{
    char ch[20];
	int i=0;
	while(cin >> ch[i]){
		i++;
	}
	for(int j=i-1 ; j>=0 ; j--){
		cout<<ch[j];
	}
	cout<<endl;
	return 0;
}

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


#define ll long long
#define ull unsigned long long
#define pb push_back

#define fr(i,a,b)   for(i=a;i<=b;i++)
#define frn(i,a,b)  for(i=a;i>=b;i--)
#define mem(arr,val)    memset(arr,val,sizeof(arr))
#define mp make_pair
#define pii pair<int,int>
#define F first
#define S second
int main()
{
    //freopen("d://i.txt","r",stdin);
    //freopen("d://o.txt","w",stdout);

    //ios_base::sync_with_stdio(0);
    //cin.tie(0);
    ll n,k,x,y,ans=0;
    cin>>n>>k>>x>>y;

    if(k<=n)
    ans=k*x+(n-k)*y;
    else
    ans=n*x;

    cout<<ans<<endl;



    return 0;
}





Measured memory_bytes: 256
line = gets.split(' ').map(&:to_i)
a=[]
for i in 0..line[1]-1
  a.push(line[2])
end
for j in line[1]..line[0]-1
  if line[2]!=1 then
    a.push(line[2]-1)
  else
    a.push(2)
  end
end
puts a.join(' ')

Measured memory_bytes: 4732
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))
ceil = lambda a, b: (a + b - 1) // b

n, k = inm()
a = inl()
start = a.index(1)
ans = 10**9
for i in range(max(0, start-k+1), min(n-1, start+k)):
    ans = min(ans, ceil(i, k-1) + ceil(n-i-1, k-1))
print(ans)

Measured memory_bytes: 20712
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
template<typename X>
struct Graph{
  int node;
  int nedge;
  //  vector<vector<int>> edge;
  vector<vector<pair<int,X>>> edge;
  vector<vector<X>> d;
  // int liq;
  // vector<vector<int>> edge2;
  const int inf = 1e+9+10;
  
  // Graph(int n,int l){
  //   node = n;
  //   liq = l;
  //   edge.resize(node,vector<int>(node,inf));
  //   edge2.resize(node,vector<int>(node,inf));    
  // }

  Graph(int n,int m,vector<int> a,vector<int> b,vector<X> c){
    node = n;
    nedge = m;
    edge.resize(node);
    rep(i,nedge){
      edge[a[i]].push_back(make_pair(b[i],c[i]));
    }
  }
  
  // void add(int from,int to,int cost){
  //   edge[from][to]=cost;
  // }

  void wf(){
    d.resize(node,vector<X>(node,inf));
    rep(v,node){
      for(auto w:edge[v]){
	d[v][w.first] = w.second;
	d[w.first][v] = w.second;	
      }
    }
    rep(k,node){
      rep(i,node){
  	rep(j,node){
	  d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
	}
      }
    }
  }

  X get_d(int x,int y){
    return d[x][y];
  }

  void show_d(){
    rep(i,node){
      rep(j,node){
	cout << i << ":" << j << ":" << d[i][j] << "\n";
      }
    }
  }
  
  // void add2(){
  //   rep(i,node){
  //     rep(j,node){
  // 	if(i==j) continue;
  // 	if(edge[i][j]<=liq) edge2[i][j]=1;
  //     }
  //   }
  // }
  
  // void wf2(){
  //   rep(k,node){
  //     rep(i,node){
  // 	rep(j,node){
  // 	  edge2[i][j]=min(edge2[i][j],edge2[i][k]+edge2[k][j]);
  // 	}
  //     }
  //   }
  // }

  
  

};



int main()
{
  int n,m,l;
  cin >> n >> m >> l;
  vector<int> a(m),b(m),c(m);
  rep(i,m){
    cin >> a[i] >> b[i] >> c[i];
    a[i]--;
    b[i]--;
  }
  int q;
  cin >> q;
  vector<int> s(q),t(q);
  rep(i,q) {
    cin >> s[i] >> t[i];
    s[i]--;
    t[i]--;
  }

  Graph<int> gp(n,m,a,b,c);

  // rep(i,m){
  //   a[i]--;
  //   b[i]--;
  //   gp.add(a[i],b[i],c[i]);
  //   gp.add(b[i],a[i],c[i]);    
  // }
  gp.wf();

  // gp.add2();
  // gp.wf2();

  //  gp.show_d();
  vector<int> aa,bb,cc;
  
  rep(i,n){
    rep(j,n){
      if(i==j) continue;
      if(gp.get_d(i,j)<=l){
	aa.push_back(i);
	bb.push_back(j);
	cc.push_back(1);
      }
    }
  }

  Graph<int> gp2(n,(int)aa.size(),aa,bb,cc);
  gp2.wf();
  //  gp2.show_d();
  
  rep(i,q){
    int res = gp2.get_d(s[i],t[i]);
    if(res==gp2.inf){
      cout << -1 << "\n";
    }
    else{
      cout << res-1 << "\n";
    }
  }
  
  
  // rep(i,q){
  //   s[i]--;
  //   t[i]--;
  //   if(gp.edge2[s[i]][t[i]]==inf) cout << -1 << "\n";
  //   else cout << gp.edge2[s[i]][t[i]]-1 << "\n";
  // }
  

  
  return 0;
}


Measured memory_bytes: 5736
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,t,i,c,x,mn=INT_MAX,f=1;
    cin>>n>>t;
    int a[n+2],b[n+2];
    for(i=0; i<n; i++)
    {
        cin>>a[i]>>b[i];

    }
    for(i=0; i<n; i++)
    {
        if(b[i]<=t)
        {
            mn=min(mn,a[i]);
            f=0;
        }

    }
    if(f==0)
        cout<<mn<<endl;
   else
        cout<<"TLE"<<endl;

}


Measured memory_bytes: 256
# 169A
# A × B を求めてください

# 1.入力をプログラムで扱えるように受け取ること
a, b = map(int, input().split())
# print(a, b)

# 2.受け取った入力値を使って、適切に処理すること
answer = a * b

# 3.計算した結果を出力すること
print(answer)


Measured memory_bytes: 9144
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef long double ld;
typedef vector<ll>VI;
typedef pair<int,int>P;
#define VV(T) vector<vector<T>>
#define sz(x) int(x.size())
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i,n) for (ll i=(ll)n-1;i>=0;i--)
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=c_max(x,a)
#define chmin(x,a) x=c_min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX6 1001001//6
#define MAX7 10010010//7
#define SENTINEL 2000000000//9
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
#define CLR(mat) memset(mat, 0, sizeof(mat))
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}//最大公約数
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}//最小公倍数
template<class T> bool contain(const std::string& s, const T& v) {
   return s.find(v) != std::string::npos;
}
const int MOD = 998244353;

inline ll mod_add(ll a,ll b){return (a+b)%MOD;}
inline ll mod_sub(ll a,ll b){return (a+MOD-b)%MOD;}
inline ll mod_mul(ll a,ll b){return ((a%MOD)*(b%MOD))%MOD;}
inline ll mod_pow(ll x,ll n,ll mod=(ll)MOD){ll res=1;while(n>0){
if(n&1)res=res*x%mod;
x=x*x%mod;n>>=1;}return res;}
inline ll mod_inv(ll x){return mod_pow(x,MOD-2);}
inline ll mod_div(ll a, ll b){return mod_mul(a,mod_inv(b));}
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// vector型から重複を削除 list.erase(unique(ALL(list)),list.end());
// g++ -o a a.cpp -Wall -lm -std=c++17
//push_back -> emplace_back

int main(){
   int n,m;
   cin>>n>>m;
   vector<pair<int,int>>key;
   rep(i,m){
      int a,b;
      cin>>a>>b;
      int s=0;
      rep(j,b){
         int c;
         cin>>c;
         c--;
         s|=1<<c;
      }
      key.emplace_back(s,a);
   }
   VI dp(1<<n,INF);
   dp[0]=0;
   rep(s,1<<n){
      rep(i,m){
         int t=s|key[i].first;
         int cost=dp[s]+key[i].second;
         chmin(dp[t],cost);
      }
   }
   ll ans=dp.back();
   if(ans==INF)ans=-1;
   cout<<ans<<endl;
   return 0;
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const ll mod = 1e9+7;

long long Modpow(long long a, int n){
  if(n == 0) return 1;
  if(n%2 == 0){
    long long res = Modpow(a, n/2);
    return res * res % mod;
  }
  return a * Modpow(a, n-1) % mod;
}

int inv(int n) { // 逆元
  return Modpow(n, mod-2);
}

struct Combination { 
  vector<long long> fact, ifact;
  Combination(int n):fact(n+1), ifact(n+1) {
    fact[0] = 1;
    for(long long i = 1; i <= n; i++) fact[i] = fact[i-1]*i % mod;
    ifact[n] = inv(fact[n]);
    for(long long i = n; i >= 1; i--) ifact[i-1] = ifact[i]*i % mod;
  }
  long long operator()(int n, int k) { // modcom (nCk % mod)
    if(k < 0 || k > n) return 0;
    return ((fact[n] * ifact[k]) % mod * ifact[n-k]) % mod;
  }
};

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

  int n, k;
  cin >> n >> k;
  Combination com(n);
  k = min(k, n-1);
  ll ans = 0;
  for(int i = 0; i <= k; i++) { // i = 0人の部屋の数
    int r = n-i; // r = 0人でない部屋の数
    ans += com(n,i) * com(n-1,r-1);
    ans %= mod;
  }
  cout << ans << endl;
}

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

#define FOR(i,b,e) for(int i=(b); i <= (e); ++i)
#define FORD(i,b,e) for(int i=(b); i >= (e); --i)
#define SIZE(c) (int) (c).size()
#define FORE(i,c) FOR(i,0,SIZE(c)-1)
#define FORDE(i,c) FORD(i,SIZE(c)-1,0)

#define pb push_back
#define mp make_pair
#define st first
#define nd second


using namespace std;

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

typedef vector <int> VI;
typedef vector <bool> VB;
typedef vector <pii> VP;
typedef vector <ll> VL;
typedef vector <pll> VPL;

typedef vector <VI> VVI;
typedef vector <VL> VVL;
typedef vector <VB> VVB;
typedef vector <VP> VVP;

const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000000000000001LL;


/*************************************************************************/

int main() {
    ios_base::sync_with_stdio(0);
    
    int n;
    cin >> n;
    
    VL tab(n);
    FOR(i,0,n-1) cin >> tab[i];
    
    int ans = 0;
    for (int i = 0; i < n;) {
        ans++;
    
        int j = i + 1;
        while (j < n-1 && tab[j] == tab[i]) {
            j++;
        }
        
        ll diff = tab[j-1] - tab[j];
        
        while (j < n-1 && diff * (tab[j] - tab[j+1]) >= 0) {
            j++;
        }
        
        i = j + 1;
    }
    
    cout << ans;

    return 0;
}

/*************************************************************************/


Measured memory_bytes: 1024
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
nums = [int(input()) for i in range(N)]
ans = 'No'

for i in range(N):
    for j in range(3):
        for p in range(3):
            if nums[i] == A[j][p]:
                A[j][p] = 'x'

for i in range(3):
    if A[i][0] == 'x' and A[i][1] == 'x' and A[i][2] == 'x':
        ans = 'Yes'

for i in range(3):
    if A[0][i] == 'x' and A[1][i] == 'x' and A[2][i] == 'x':
        ans = 'Yes'

if A[0][0] == 'x' and A[1][1] == 'x' and A[2][2] == 'x':
    ans = 'Yes'
    
if A[0][2] == 'x' and A[1][1] == 'x' and A[2][0] == 'x':
    ans = 'Yes'

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MP make_pair
#define FI first
#define SE second
using namespace std;

struct Edge{
  int a,b,c;
  bool operator<(const Edge& o) const{
    return c<o.c;
  }
};

struct UnionFind{
  vector<int> p;
  UnionFind(int n):p(n){
    REP(i,n) p[i]=i;
  }
  int find(int x){
    if(x==p[x]) return x;
    return p[x]=find(p[x]);
  }
  int unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y){ 
      return 0;
    }else{
      p[y]=x;
      return 1;
    }
  }
};

int main(){
  int N; cin>>N;
  
  int x,y;
  vector<pair<int,int>> xi(N),yi(N);
  REP(i,N){
    cin>>x>>y;
    xi[i]=MP(x,i);
    yi[i]=MP(y,i);
  }
  sort(ALL(xi));
  sort(ALL(yi));
  
  vector<Edge> es;
  REP(i,N-1){
    es.push_back({xi[i].SE,xi[i+1].SE,xi[i+1].FI-xi[i].FI});
    es.push_back({yi[i].SE,yi[i+1].SE,yi[i+1].FI-yi[i].FI});
  }
  sort(ALL(es));
  
  long long ans=0;
  UnionFind uf(N);
  for(Edge e:es){
    if(uf.unite(e.a,e.b)) ans+=e.c;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 7984
import time
def gcd(a, b):
    return a if b == 0 else gcd(b, a%b)

K = int(input())
res = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            res += gcd(gcd(i, j), k)
print(res)

Measured memory_bytes: 80244
X = int(input())
def is_prime(n):
    if n == 2: return True
    if n < 2 or n%2 == 0: return False
    m = 3
    while m*m <= n:
        if n%m == 0: return False
        m += 2
    return True

while True:
    if is_prime(X):
        print(X)
        exit()
    X += 1

Measured memory_bytes: 3060
N = int(input())
a_list = []
b_list = []

for i in range(N):
    a, b = map(int, input().split())
    a_list.append(a)
    b_list.append(b)

count = 0
for i in range(N-1, -1, -1):
    a = a_list[i]
    b = b_list[i]
    if a == 0:
        continue
    if b == 1:
        continue

    if count > 0:
        a += count
    if a % b == 0:
        continue

    margin = b - (a % b)
    count += margin
print(count)

Measured memory_bytes: 11048
#include <stdio.h>
int main(void){
	int paper[10][10];
	int i,j;
	int ink_size,x,y;
	int no = 0;
	int ink_depth = 0;
	
	for(i = 0;i < 10;i++){
		for(j = 0;j < 10;j++){
			paper[i][j] = 0;
		}
	}
	
	while(scanf("%d,%d,%d",&x,&y,&ink_size) != EOF){
		switch(ink_size){
			case 1:
				for(i = -1;i <= 1;i++){
					if(x+i >= 0&&x+i <= 9)paper[x+i][y]++;
				}
				for(i = -1;i <= 1;i++){
					if(y+i >= 0&&y+i <= 9)paper[x][y+i]++;
				}
				paper[x][y]--;
				break;
			case 2:
				for(i = -1;i <= 1;i++){
					for(j = -1;j <= 1;j++){
						if(x+i >= 0&&x+i <= 9&&y+j >= 0&&y+j <= 9)paper[x+i][y+j]++;
					}
				}	
				break;
			case 3:
				for(i = -1;i <= 1;i++){
					for(j = -1;j <= 1;j++){
						if(x+i >= 0&&x+i <= 9&&y+j >= 0&&y+j <= 9)paper[x+i][y+j]++;
					}
				}
				
				if(x-2 >= 0)paper[x-2][y]++;
				if(x+2 <= 9)paper[x+2][y]++;
				if(y-2 >= 0)paper[x][y-2]++;
				if(y+2 <= 9)paper[x][y+2]++;
				break;
		}
	}
	
	for(i = 0;i < 10;i++){
		for(j = 0;j < 10;j++){
			if(paper[i][j] == 0)no++;
			if(paper[i][j] > ink_depth)ink_depth = paper[i][j];
		}
	}
	printf("%d\n%d\n",no,ink_depth);
	
	return 0;
}

Measured memory_bytes: 600
import collections

N = int(input())
s = []
for i in range(0, N):
  s.append(input())

c = collections.Counter(s)
counter = c.most_common()

max_count = counter[0][1]
max_counter = 0

for order in counter:
  if max_count == order[1]:
    max_counter += 1
  else:
    break;

counter = counter[:max_counter]

for s in sorted(counter):
  print(s[0]);

Measured memory_bytes: 46104
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define endl "\n"

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
    oreno_initializer() {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }
} oreno_initializer;



int a, b, c, n, res;

signed main() {
    cin >> a >> b >> c >> n;
    rep(i,3001) rep(j,3001) {
        int k = n - (i*a+j*b);
        if (0<=k && k%c==0) res++;
    }
    cout << res << endl;
}


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

int main(){
    int a, b, coins;
    cin >> a >> b;
    coins = max(a,b);

    if(a  > b){
        coins += a - 1;
    }else if(a < b){
        coins += b - 1;
    }else{
        coins += a;
    }
    cout << coins << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <math.h>
using namespace std;
int main(){
		int K;
		cin >> K;
		if(K%2 == 0){
				cout << pow(K/2,2) << endl;
		}
		else cout << (K/2)*(1+K/2) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define all(vec) vec.begin(), vec.end()
#define MOD 1000000007
#define intt int64_t

int main() {
    int n, l;
    scanf("%d %d", &n, &l);
    int ans=0, minn[2]={MOD,MOD};
    rep(i,n) {
        ans+=i+l;
        if(minn[1]>abs(i+l))minn[0]=i+l,minn[1]=abs(i+l);
    }
    printf("%d\n", ans-minn[0]);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
//#define INF 1e18
#define MOD 998244353

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

ll n,m,k;

const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX]; //n!, 1/n!, 1/n

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//xのn乗
ll mod_pow(ll x, ll n){
  if(n==0) return 1;
  ll res = mod_pow(x*x%MOD,n/2);
  if(n & 1) res = res*x%MOD;
  return res;
}

int main(){
  ll ans=0;
  cin >> n >> m >> k;
  COMinit();
  rep(i,0,k+1){
    ll u = COM(n-1,i);
    u *= mod_pow(m-1,n-1-i);
    u %= MOD;
    (u *= m) %= MOD;
    ans += u;
    ans %= MOD;
  }
  cout << ans << endl;
   return 0;
}


Measured memory_bytes: 15592
#include <stdio.h>
#include <string.h>
#define MAX 80

/*
¶ðó·éI[g}g
state 0( )¨state 1(t)¨state 2(h)¨state 3(e)¨state 4( )¨OK
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@¥(i)¨state 5(s)¨state 4
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@¤(a)¨state 6(t)¨state 4
*/

int main(void){
	char sentence[MAX]; int i, state;
	
	while(1){
		/* load */
		if((sentence[0]=getchar())==EOF) return 0;
		i=1; while((sentence[i++]=getchar())!='\n');
		
		while(1){
			
			/* check */
			state=1, i=-1;
			while(1){
				if(sentence[++i]=='\n') break;
				else if(sentence[i]==' ' && state==4) break;
				else if(sentence[i]=='.' && state==4) break;
				else if(sentence[i]==' ') state=1;
				else if(sentence[i]=='t' && state==1) state=2;
				else if(sentence[i]=='h' && state==2) state=3;
				else if(sentence[i]=='e' && state==3) state=4;
				else if(sentence[i]=='i' && state==3) state=5;
				else if(sentence[i]=='a' && state==3) state=6;
				else if(sentence[i]=='s' && state==5) state=4;
				else if(sentence[i]=='t' && state==6) state=4;
				else state=0;
			}
			if(state==4) break;
			
			/* next */
			else for(i=0; sentence[i]!='\n'; i++)
				if('a'<=sentence[i] && sentence[i]<='z')
					sentence[i]=(sentence[i]-'a'+1)%26+'a';
					
		}
		
		i=0; while(sentence[i]!='\n') printf("%c",sentence[i++]); printf("\n");
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
vector<int> adj[100005];
int dp[100005];

int solve (int u) {
    if (!dp[u]) {
        for (int v : adj[u]) {
            dp[u] = max(solve(v), dp[u]);
        }
        dp[u]++;
    }
    return dp[u];

}

int main(){
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
       adj[a].push_back(b);
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans = max(solve(i), ans);
    }
    cout << ans - 1 << "\n";
    return 0; 
}

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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            string input;
            int[] array = new int[100];
            while ((input = Console.ReadLine()) != null)
            {
                int d = int.Parse(input);
                array[d-1]++;
            }

            List<int> resultList = new List<int>();
            int max = 0;
            int num = 1;
            foreach (int a in array)
            {
                if (a == max)
                {
                    resultList.Add(num);
                }
                else if (a > max)
                {
                    resultList.Clear();
                    resultList.Add(num);
                    max = a;
                }

                num++;
            }


            foreach (int n in resultList)
            {
                Console.WriteLine(n);
            }


        }
    }
}

Measured memory_bytes: 5664