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

class Main {
    static Scanner scanner = new Scanner();
    static int mod = 1000000007;
    static int inf = 0x7ffffff;

    void solve() {
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        int c = x == 1 && y == 1 ? 4 : 0;
        if (x == 3) {
            c += 1;
        } else if (x == 2) {
            c += 2;
        } else if (x == 1) {
            c += 3;
        }
        if (y == 3) {
            c += 1;
        } else if (y == 2) {
            c += 2;
        } else if (y == 1) {
            c += 3;
        }
        System.out.println(c * 100000);
    }

    public static void main(String[]$) throws Exception {
        new Main().solve();
        System.out.flush();
    }
}

class System {
    static PrintWriter out = new PrintWriter(java.lang.System.out);

    static void exit() {
        java.lang.System.exit(0);
    }
}

class Scanner {
    private BufferedReader reader = new BufferedReader(new InputStreamReader(java.lang.System.in), 0x10000);
    private StringTokenizer tokenizer;

    String next() {
        try {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
        } catch (IOException ignored) {
        }
        return tokenizer.nextToken();
    }

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

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

    char[][] nextCharArray(int n, int m) {
        char[][] a = new char[n][m];
        for (int i = 0; i < n; i++) {
            a[i] = next().toCharArray();
        }
        return a;
    }

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

    int[] nextIntArray(int n, IntUnaryOperator op) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = op.applyAsInt(nextInt());
        }
        return a;
    }

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

    long[] nextLongArray(int n, LongUnaryOperator op) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = op.applyAsLong(nextLong());
        }
        return a;
    }
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef vector<pll> vpll;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back

inline void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

inline void OUT(void){
  cout << "\n";
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  ll N, K;
  IN(N, K);
  vll A(N);
  REP(i,N){
    IN(A[i]);
  }

  ll ans = 0;
  REP(i,N){
    FOR(j,i+1,N){
      if(A[i]>A[j]) ans++;
      ans %= MOD;
    }
  }

  ans *= K;
  ans %= MOD;

  sort(ALL(A));

  ll shift = 0;
  REP(i,N){
    REP(j,N){
      if(A[i]>A[j]) shift++;
      shift %= MOD;
    }
  }

  ll tmp = (K*(K-1))/2;
  tmp %= MOD;
  shift *= tmp;
  shift%=MOD;
  ans += shift;

  OUT(ans%MOD);

  return 0;
}


Measured memory_bytes: 256
def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

teams = [0 for i in range(101)]
points = [False for i in range(31)]
while True:
    a,b = [int(i) for i in input().split(",")]
    if a == 0 and b == 0:
        break

    teams[a] = b
    points[b] = True

N = list(get_input())
for l in range(len(N)):
    q = int(N[l])
    p = teams[q]
    ans = 0
    for i in range(30,-1,-1):
        if points[i]:
            ans += 1
        if i == p:
            break
    print(ans)



Measured memory_bytes: 5600
#include <bits/stdc++.h>
#define int long long
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define pii pair<int,int>
#define ff first
#define ss second
#define frr(s,n) for(int i=s;i<n;i++)
#define inf 10000000000 //1e10
using namespace std;
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }
int32_t main(){
    int n;
    cin >> n;
    vector<double> dp(n+1);
    dp[0] = 1;
    for(int i=0;i<n;i++){
        double x;
        cin >> x;
        for(int j=n-1;j>=0;j--){
            dp[j+1] += dp[j] * x;
            dp[j] = dp[j] * (1-x);
        }
    }
    double ans = 0;
    for(int i=(n/2)+1;i<=n;i++)
        ans+=dp[i];
    cout << fixed << setprecision(12) << ans << endl;

}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(void)
{
	int n,a[100],i,cnt;
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%d",&a[i]);
	sort(a,a+n);
	cnt=1;
	for(i=1;i<n;i++){
		if(a[i]!=a[i-1]) cnt++;
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define se second
#define fi first
#define pb push_back

int main(){

//	freopen("in.txt","r",stdin);

	int q;
	scanf("%d",&q);
	while(q--){
		ll a,b,c,d;
		scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
		ll l=0,r=a + b,k=(max(a,b) + min(a,b)) / (min(a,b) + 1),ea=a + b + 1,
			nA=a,nB=b;
		while(l <= r){
			ll mid=(l + r) / 2;
			ll na=a,nb=b;
			na-=(mid / (k + 1)) * k + mid % (k + 1);
			nb-=(mid / (k + 1));
			if(na < 0 || nb < 0 || nb > na * k){
				ea=mid;
				nA=na, nB=nb;
				r=mid - 1;
			}
			else l=mid + 1;
		}
		ll l1=1,r1=ea,l2=ea + 1,r2=ea + nB - nA * k,l3=ea + nB - nA * k,r3=a
			+ b;
		for(ll i=c;i <= d;i++){
			if(i >= l1 && i <= r1){
				ll x=i - 1;
				if(x % (k + 1) == k) printf("B");
				else printf("A");
			}
			else if(i >= l2 && i <= r2){
				printf("B");
			}
			else if(i >= l3 && i <= r3){
				ll x=i - r2 - 1;
				if(x % (k + 1)) printf("B");
				else printf("A");
			}
		}
		puts("");
	}

}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(void){
    int N;
    cin >> N;
    int x[N], y[N], h[N];
    for(int i=0; i < N; i++) {
        cin >> x[i] >> y[i] >> h[i];
    }
    int numOfHi;
    for(int l = 0; l < N; l ++) {
        if(h[l] != 0) {
            numOfHi = l;
            break;
        }
    }
    for(int posX = 0; posX <= 100; posX++) {
        for(int posY = 0; posY <= 100; posY++) {
             int temp_hi = h[numOfHi] + abs(posX - x[numOfHi]) + abs(posY - y[numOfHi]);
             int flag = 0;
             
             for(int i = 0; i < N; i++) {
                 if(h[i] != max(temp_hi - (abs(posX - x[i]) + abs(posY - y[i])), 0)) flag = -1;
             }
             if(flag == 0) cout << posX << " " << posY << " " << temp_hi << endl;
             
            
        }
    }
}

Measured memory_bytes: 256
while True:
    n, x = map(int, input().split())
    if n == 0 and x == 0:
        break
    ans = 0
    for i in range(1, n+1):
        for j in range(i+1, n+1):
            for k in range(j+1, n+1):
                if i + j + k == x:
                    ans += 1
    print(ans)
            


Measured memory_bytes: 5592
#include <bits/stdc++.h>
const char nl = '\n';
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> pt;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int N = 1e5+10;

int n, k;
int h[N];
int dp[N];

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  for (int i = 1; i < n; i++) {
    dp[i] = INF;
    for (int j = max(0, i-k); j < i; j++) {
      dp[i] = min(dp[i], dp[j] + abs(h[i]-h[j]));
    }
  }
  cout << dp[n-1] << nl;
  return 0;
}


Measured memory_bytes: 1024
//#include <bits/stdc++.h>
//#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <bitset>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <string>
#include <string.h>
#include <cmath>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <cctype>
#include <fstream>

#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define LFOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define LRFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define INF 1000000000			 //2000000000
#define LINF 1000000000000000000 //9000000000000000000
#define DINF 1000000000000000.0
#define PI 3.14159265358979
#define MAXI 7500000

//.size()はunsigned int　0-1をするとオーバーフローする

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

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

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

long long int gcd(long long int a, long long int b)
{ //最大公約数
	if (b == 0)
	{
		return a;
	}
	return gcd(b, a % b);
}

long long int lcm(long long int a, long long int b)
{ //最小公倍数
	long long int g = gcd(a, b);
	return a / g * b;
}

int main(void)
{
	long long int n;
	long long int maxi;

	cin >> n;
	vector<long long int> a(n);
	FOR(i,0,n-1){
		cin >> a[i];
		if(i>0){
			maxi = lcm(maxi, a[i]);
		}else{
			maxi = a[0];
		}
	}

	cout << maxi << endl;

}



Measured memory_bytes: 3104
import java.io._
import scala.io.StdIn.{readInt, readLine}

object Main {
  val out:BufferedWriter =
    new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512)
  var count = 0
  class Node(var key:Int, var left:Node = null, var right:Node = null) { }

  def getNodeToInsert(node:Node,keyNode:Node):Node =
    if(node.key > keyNode.key) {
      if(node.left == null) node
      else getNodeToInsert(node.left,keyNode)
    } else {
      if(node.right == null) node
      else getNodeToInsert(node.right,keyNode)
    }

  def insert(tree:Node, keyNode:Node) = {
    val target = getNodeToInsert(tree,keyNode)
    if(keyNode.key < target.key) target.left = keyNode
    else target.right = keyNode
  }

  def inOrder(tree:Node):Unit =
    if(tree == null) return
    else {
      inOrder(tree.left)
      out.write(" ")
      out.write(tree.key.toString)
      out.flush
      inOrder(tree.right)
    }

  def preOrder(tree:Node):Unit =
    if(tree == null) return
    else {
      out.write(" ")
      out.write(tree.key.toString)
      if(count<100) count += 1
      else {
        out.flush
        count = 0
      }
      preOrder(tree.left)
      preOrder(tree.right)
    }

  def main(args:Array[String]) = {
    val n = readInt
    val tree = new Node(-1)

    for(i<-0 until n) {
      val s = readLine.split(" ")
      s(0) match {
        case "insert" =>
          if(tree.key == -1) tree.key = s(1).toInt
          else insert(tree, new Node(s(1).toInt))
        case _ => {
          inOrder(tree)
          out.write("\n")
          out.flush()
          preOrder(tree)
          out.write("\n")
          out.flush()
        }
      }
    }
  }
}

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

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

#define mem0(x) memset(x, 0, sizeof(x))
#define asort(x) sort(x.begin(), x.end());
#define dsort(x, t) sort(x.begin(), a.end(), greater<t>());
#define mp make_pair
#define pb push_back

int main() {
    int A, B, C, D, flagT;
    flagT = 0;
    cin >> A >> B >> C >> D;

    while(true) {
        C -= B;
        if(A <= 0) {
            flagT = 1;
            break;
        } else if(C <= 0) {
            flagT = 0;
            break;
        }
        A -= D;
        if(A <= 0) {
            flagT = 1;
            break;
        } else if(C <= 0) {
            flagT = 0;
            break;
        }
    }

    if(flagT) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 3612
#define _USE_MATH_DEFINES
#include  <iostream>
#include  <algorithm>
#include  <climits>
#include  <vector>
#include  <string>
#include  <cstring>
#include  <stack>
#include  <queue>
#include  <cmath>
#include  <iomanip>
#include  <set>
#include  <map>
#include  <new>
#include <cstdint>
#include <cctype>
using namespace std;
#define rep(i,n)  for(int i = 0; i < n; i++)
#define lrep(i,n,m)  for(int i = n; i < m; i++)

using ll = long long;
using ld = long double;
using Vii = vector<vector<int> >;
using Gjudge = vector<vector<bool>>;
using Vi = vector<int>;
using Vl = vector<ll>;
using Vd = vector<double>;
using Vld = vector<long double>;
using Vll = vector<vector<ll> >;
using Vldd = vector<vector<ld> >;
using Vs = vector<string>;
using Vb = vector<bool>;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Ti = tuple<int, int, int>;
using Tl = tuple<ll, ll, ll>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int Mod = static_cast<int>(1e9 + 7);
const int INF = INT_MAX;
const ll LINF = LLONG_MAX / 10000;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };

int main()
{
	string s;
	cin >> s;
	int n = s.size();
	Vi m(n + 1, -1);
	m[0] = 0;
	Vi mod2019(2019, 0);
	mod2019[0]++;
	ll k = 1;
	for (int i = n - 1; i >= 0; i--) {
		k %= 2019;
		m[n - i] = (m[n - i - 1] + k * (s[i] - '0')) % 2019;
		mod2019[m[n - i]]++;
		k *= 10;
	}
	//lrep(i, 1, n + 1)  cout << m[i] << endl;
	ll ans = 0;
	rep(i, 2019) {
		ll tmp = mod2019[i];
		ans += tmp * (tmp - 1) / 2;
	}
	cout << ans << endl;
}


Measured memory_bytes: 4392
use std::io;


fn main() {
    let n = read_one::<usize>();
    println!("{}", n / 3);
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    vector<int> acc(N + 1), acc_back(N + 1);
    for (int i = 0; i < N; i++) {
        acc[i + 1] = acc[i] + (S[i] == '#');
    }
    for (int i = N; i > 0; i--) {
        acc_back[i - 1] = acc_back[i] + (S[i] == '.');
    }

    int ans = N;
    for (int i = N; i >= 0; i--) {
        ans = min(ans, acc_back[i] + acc[i]);
    }
    cout << ans << endl;

}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();
}

Measured memory_bytes: 2196
//Heaplax
//别让自己后悔
#include<bits/stdc++.h>
#define N 100001
#define LL long long
#define LOG(x) cerr<<#x<<" = "<<x<<endl
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(int& x)
{
	while(ch=getchar(),ch<33);
	if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
	while(ch=getchar(),ch>33)x=x*10+ch-48;
	if(fs)x=-x;
}
using namespace std;
int n,m,d[N];
int main()
{
	re(n),re(m);
	for(int u,v;m--;)
	{
		re(u),re(v);
		++d[u];++d[v];
	}
	for(int i=1;i<=n;++i)
		if(d[i]&1)
			return puts("NO"),0;
	puts("YES");
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <vector>
#include <string>

//Some constants don't work
#ifndef INT_MAX
#define INT_MAX 2147483647
#endif
#ifndef INT_MIN
#define INT_MIN -2147483648
#endif
//short hand tricks
typedef long long ll;

using namespace std;

int main(int argc, char * argv[]) {
    ios_base::sync_with_stdio(false);
    ll X,K,D;
    cin >>X>>K>>D;
    //even odd parity of the points matters
    //can always waste 2 moves by moving there and back
    //get as close to D in upto K moves
    ll distance = abs(X);
    ll moves = distance/D;
    ll takenMoves = min(moves, K);
    K-=takenMoves;
    ll newX = min(abs(takenMoves*D+X), abs(X-takenMoves*D));
    //mod 2 moves left
    ll movesLeft = K%2;
    if(movesLeft>0) {
        newX = min(abs(newX+D), abs(newX-D));
    }
    cout << newX << "\n";
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define j1 j1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;



void Main(){

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

  cout<< ( a<=8 and b<=8 ? "Yay!" : ":(" )<<"\n";
  

}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 256
#include <iostream>
#include <cassert>
//#define NDEBUG
int main(void){
    using namespace std;
    static const int LEN_MAX = 100;
    static const int BREADTH_MAX = 100;
    int length =0;
    int breadth =0;
    cin >> length;
    cin >> breadth;
 
    assert((length <= LEN_MAX) && (breadth <= BREADTH_MAX));	/* Precondition */
 
    /* Calculation  Area, perimeter */
    cout << length*breadth << " " << (length+breadth)*2 << endl;
     
    return 0;
}

Measured memory_bytes: 3068
#include <iostream>
int main(){
    using namespace std;
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(abs(a-c)<=d){
        cout << "Yes" << endl;
    }else if(abs(a-b)<=d && abs(b-c)<=d){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
<?php
list($m, $k) = explode(" ", trim(fgets(STDIN)));
 
if($k == 0){
    $limit = 2 ** $m;
    for($i = 0; $i < $limit; $i++){
        $array[] = $i;
        $array[] = $i;
    }
    echo implode(" ", $array);
}elseif($m == 1){
    echo -1;
}else{
    if($k > 2 ** $m - 1){
        echo -1;
    }else{
        for($i = 0; $i < 2 ** $m; $i++){
            if($i != $k)$array[] = $i;
        }
        $array[] = $k;
        for($i = 2 ** $m - 1; $i >= 0; $i--){
            if($i != $k)$array[] = $i;
        }
        $array[] = $k;
        echo implode(" ", $array);
    }
}

Measured memory_bytes: 18932
N = int(input())
P = list(map(int, input().split(' ')))

cnt = 0
R = []
for i in range(N):
    if i == 0:
        cnt += 1
        last = P[i]
    else:
        if last > P[i]:
            cnt += 1
            last = P[i]

print(cnt)

Measured memory_bytes: 24744
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
#define SZ(x) (int)((x).size())
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int64 power_mod(int64 a, int64 n, int p = MOD) {
  int64 ret = 1;
  for (; n; n >>= 1) {
    if (n & 1) ret = ret * a % p;
    a = a * a % p;
  }
  return ret;
}

int main() {
  int n;
  cin >> n;
  int ret = power_mod(10, n);
  ret = (ret + MOD - power_mod(9, n)) % MOD;
  ret = (ret + MOD - power_mod(9, n)) % MOD;
  ret = (ret + power_mod(8, n)) % MOD;
  cout << ret << '\n';
  return 0;
}


Measured memory_bytes: 3172
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <iomanip>
#include <utility>
#include <cstdlib>

#define MOD 1000000007
using namespace std;
typedef  long double ll;

int main(){
    int n,d,count=0;
    cin>>n>>d;
    vector<vector<int>>x(n,vector<int>(d));
    for(int i=0;i<n;i++){
        for(int j=0;j<d;j++){
            cin>>x.at(i).at(j);
        }
    }
    
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            double sum=0;
            int tmp;
            for(int k=0;k<d;k++){
                sum+=(x.at(i).at(k)-x.at(j).at(k))*(x.at(i).at(k)-x.at(j).at(k));
                }
            tmp=sqrt(sum);
            if(sqrt(sum)==tmp){
                count++;
            }
        }
    }
    cout<<count<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include<algorithm> 
#include <iomanip>
#include <math.h>
#include <iostream>
#include <bitset>

#define db double
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define ll long long
#define ld long double
#define maxn 5005
#define mod 998244353
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define vv(z,a,b) vector<vector<int>>z(a,vector<int>(b))
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(c) begin(c),end(c)
#define pp pair<int,int>
using namespace std;

vv(a,15,15);

int main(){
int n;cin>>n;
rep(i,n)rep(j,n) a.at(i).at(j) = -1;
//vector<vector<pp>>a(16,vector<pp>(16));
//pp x;
//vi A(n);
//int aw=0;
rep(i,n){
    int m;
    cin>>m;
    rep(j,m){
        int f,s;
        cin>>f>>s;
        //a.at(i).at(j)=make_pair(f,s);
        --f;
        a.at(i).at(f)=s;
    }
}
    //bitset<16> bs;
   int ans=0;
for(int bits=0;bits<(1<<n);bits++){
    //int flag=0;
    //int ans=0;
    vi d(n);
rep(j,n)if(bits>>j&1)d.at(j)=1;
    bool ok=true;
    rep(i,n){
        if(d.at(i)){
            rep(j,n){
                if(a.at(i).at(j)==-1)continue;
                if(a.at(i).at(j)!=d.at(j))ok=false;
            }


        }
    }
    if(ok)ans=max(ans,__builtin_popcount(bits));
    }

    
    //ans++;
    //bitset<16> bs=bits;
   /* if(bs.count()==ans){
        if(aw<ans)aw=ans;
    }*/

cout<<ans<<endl;

}

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

using namespace std;

#define MOD 1000000007
#define ll long long int
#define ld long double
#define pb push_back
#define mkp make_pair
#define pii pair<int, int> 
#define pll pair<long long int, long long int>
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%lld", &x)
#define fi first
#define sc second
#define deb 0

ll fact[100001];

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

	ll n, m, ans = 0, i, x, y;
	cin >> n >> m;
	fact[0] = 1;
	for (i = 1; i <= 100000; ++i) {
		fact[i] = (i * fact[i-1]) % MOD;
	}

	if (m == n || m == n+1) {
		x = (fact[m] * fact[n]) % MOD;
	} else x = 0;
	if (n == m || n == m+1) {
		y = (fact[n] * fact[m]) % MOD;
	} else y = 0;
	ans = (x + y) % MOD;
	cout << ans << endl;

	return 0;
}

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

int main() {
  // ここにプログラムを追記
  int a, b;
  int  result, buf;
  cin >> a >> b;
  buf = a+b;
  if(buf %2 == 0){
    result = buf/2;
  }else{
    result = buf/2 + 1;
  }

  cout << result << endl;
}


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

#define SIZE 1000

int main(){
	int i, ii;
	int a[SIZE];
	int b[SIZE];
	for(i=0;i < SIZE;i++){
		a[i] = 0;
	}
	for(i=0;i < SIZE;i++){
		b[i] = 0;
	}
	
	i = 0;
	ii = 0;
	while(1){
		scanf("%d %d", &a[i], &b[i]);
		if( (a[i] == 0) && (b[i] == 0)) break;
		i++;
		ii++;
		if(i > SIZE) break;
	}
	i = 0;
	int j, k, l;
	while(1){
		for(l=0;l<ii;l++){
			for(j=0;j<a[i];j++){
				for(k=0;k<b[i];k++){
					if( (j & 0x1) == 0){
						if( (k & 0x1) == 0){
							printf("#");
						}else{
							printf(".");
						}	
					}else{
						if( (k & 0x1) == 0){
							printf(".");
						}else{
							printf("#");
						}
					}
					
				}
				printf("\n");
			}
			i++;
			printf("\n");
		}
		break;
	}
	return 0;
}


Measured memory_bytes: 2104
n = int(input())
a = list(map(int, input().split()))

cum = [0] * n
cum[-1] = a[-1]

mod = 10 ** 9 + 7

for i in range(n - 1, 0, -1):
    cum[i - 1] = cum[i] + a[i - 1]

ans = 0

for i in range(1, n):
    num = a[i - 1] * cum[i]
    num %= mod
    ans += num
    ans %= mod

print(ans)


Measured memory_bytes: 93800
#include<bits/stdc++.h>
using namespace std;
typedef  long long int     ll;
typedef  vector<int>       vi;
typedef  pair<int, int>     pii;
typedef double          f80;
// #define  int               float
#define  F                 first
#define  S                 second
#define  pb                push_back
#define  mp                make_pair
#define  si(x)             (int)x.size()
#define  all(x)            x.begin(),x.end()
#define  minv(m,n)         *min_element(m,n)
#define  maxv(m,n)         *max_element(m,n)
#define  mem(a,x)          memset(a,x,sizeof(a))
#define  deb(x)            cout<<#x<<" = "<<x<<endl
#define  rep(i,n)          for(int i=0;i<n;i++)
#define  prs(x)            fixed <<setprecision(x)
#define  w(ttz)            int ttz;cin>>ttz;while(ttz--)
#define  show(a)           for(auto x:a){cout<<x<<" ";}cout<<endl;
void iosbase(void);

int32_t main()
{
  iosbase();
  int n;
  cin >> n;
  int a[n];
  rep( i ,  n)cin >> a[i];
  float avg = 0;
  float sum = 0;
  rep( i , n)sum += a[i];
  avg = sum / n;
  // deb(avg);
  avg = round(avg);
  int ans = 0;
  for (int i = 0 ; i < n ; i++)
  {
    ans += (abs(avg - a[i]) * abs(avg - a[i]) );
  }
  cout << ans << endl;


}


void iosbase(void) {
  ios::sync_with_stdio(false);
  cin.tie(nullptr); cout.tie(nullptr);
#ifndef ONLINE_JUDGE
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
#endif
}

Measured memory_bytes: 3540
#include <bits/stdc++.h>
using namespace std;
int main()
{
   string a,b;
   cin>>a>>b;
   int count=0;
   for(int i=0;i<a.size();i++)
   {
        if(a[i]!=b[i])
            count++;
   }
   cout<<count<<"\n";
}

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

using namespace std;

#define all(x) (x).begin(), (x).end()

typedef long long ll;

void solve() {
  int d, t, s; cin >> d >> t >> s;
  cout << (d <= t * s ? "Yes" : "No");
}

// CHECK LIMITS (n <= 10^5)
// CHECK CORNER CASES (n == 1)

int main() {
  ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
  cout.setf(ios::fixed), cout.precision(20);
  //cout << 1.0 * clock() / CLOCKS_PER_SEC << endl;
  solve();
}


Measured memory_bytes: 3580
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
pair<ll,int> X[100010],Y[100010];

int p[100010] = {0},r[100010] = {0};
void init(int N){
	for(int i=0;i<=N;++i) p[i] = i;
}

int root(int a){
	if(p[a] == a) return a;
	return (p[a] = root(p[a]));
}

bool is_same_set(int a,int b){
	return root(a) == root(b);
}

void unite(int a, int b){
	a = root(a);
	b = root(b);
	if(a==b) return;
	if(r[a]<r[b]){
		p[a] = b;
	}else{
		p[b] = a;
		if(r[a] == r[b]) r[a]++;
	}
}

int N;
int main(){
	cin >> N;
	init(N);
	ll x,y;
	for(int i=1;i<=N;i++){
		cin >> x >> y;
		X[i] = {x,i};
		Y[i] = {y,i};
	}
	sort(X+1,X+N+1);
	sort(Y+1,Y+N+1);
	vector<pair<ll,pair<int,int>>> v;
	for(int i=1;i<N;i++){
		v.push_back({X[i+1].first-X[i].first,{X[i].second,X[i+1].second}});
		v.push_back({Y[i+1].first-Y[i].first,{Y[i].second,Y[i+1].second}});
	}
	sort(v.begin(),v.end());
	ll ans = 0;
	for(int i=0;i<v.size();i++){
		int a = v[i].second.first,b = v[i].second.second;
		if(!is_same_set(a,b)){
			unite(a,b);
			ans += v[i].first;
	//		cout << ans << endl;
		}
	}
	cout << ans << endl;
}

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

// =======================
// ------ graph ------ //
using Weight = int;
using Flow = int;
struct Edge {
    int src, dst;
    Weight weight;
    Flow cap;
    Edge() : src(0), dst(0), weight(0) { }
    Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) { }
};
bool operator < (const Edge &e, const Edge &f) {
    return e.weight != f.weight ? e.weight < f.weight :
        e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge1(Graph &g, int a, int b, Weight w = 1) {
    g[a].emplace_back(a, b, w);
}

// ------ disjoint set ------ //
struct UnionFind {
    vector<int> data;
    int __size;
    UnionFind(int size) : data(size, -1), __size(size) { }
    bool unionSet(int x, int y) {
        if ((x = root(x)) != (y = root(y))) {
            if (data[y] < data[x]) swap(x, y);  // par -> child とは限らない
            data[x] += data[y]; data[y] = x; __size--;
        }
        return x != y;
    }
    bool findSet(int x, int y) { return root(x) == root(y); }
    int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
    int size(int x) { return -data[root(x)]; }
    int size() { return __size; }
    vector<int> subset_roots() {
        vector<int> roots;
        for (int i = 0; i < data.size(); i++) if (data[i] < 0) roots.push_back(i);
        return roots;
    }
};

// ------ kruskal ------ //
pair<Weight, Edges> kruskal(const Graph &g) {
    UnionFind uf(g.size());
    Edges es;
    for (auto &adj : g) for (auto &e : adj) es.emplace_back(e);
    sort(es.begin(), es.end());
    Weight total = 0;
    Edges T;
    for (auto &e : es) if (uf.unionSet(e.src, e.dst)) {
        T.push_back(e);
        total += e.weight;
    }
    return make_pair(total, T);
}
// =======================

int main() {
    int n; cin >> n;
    Graph G(n);
    for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) {
        int w; cin >> w;
        if (w >= 0) add_edge1(G, i, j, w);
    }
    pair<Weight, Edges> res = kruskal(G);
    cout << res.first << endl;
    return 0;
}


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

const int MAX = 100000;
int main() {
	int N, T[MAX], M;
	cin >> N;
	int sum = 0; // ドリンクを飲まなかったときにかかる時間
	for (int i = 0;i < N;i ++) {
		cin >> T[i];
		sum += T[i];
	}
	cin >> M;
	int P, X;
	for (int i = 0;i < M;i ++) {
		cin >> P >> X;
		cout << sum + (X - T[P - 1]);
		if (i < M - 1) cout << endl;
	}
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

まず、ドリンクを飲まないとΣT_iだけ時間がかかる
次に、ドリンクを飲むことを考える
ドリンクjを呑んだ時、かかる時間はΣT_i - T_(P_j) + X_j
よってこれを順次出力すれば良い
ここでΣT_iは定数であるから先に計算すると計算量を減らすことができるよ
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define All(a) (a).begin(),(a).end()


vector<ll> prime_factorization(ll x){
  vector<ll> v;
  ll i;
  for (i=2; i<x; i++){
    if(x%i==0){
      v.push_back(i);
      while(x%i==0)x/=i;
    }
  }
  if(x!=1)v.push_back(x);
  return v;
}


int main(){ 
  int n,cnt,cnt_2=0;
  set<ll> s;
  cin >> n;
  int tmp=1;
  while(tmp<=n){
    cnt=0;
    for(int i=1; i <= tmp; i++){        
      if(tmp%i==0)cnt++;
      //code
    }
    if(cnt==8)cnt_2++;
    tmp+=2;
  }
  cout << cnt_2<<endl;
  return 0;
}

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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    int r, g;
    cin >> r >> g;

    // 処理
    // 出力
    cout << g * 2 - r << endl;

    return 0;
}


Measured memory_bytes: 256
from operator import itemgetter

n = int(input())
sp = [input().split() for i in range(n)]

sorted_sp = sorted(sp,key = lambda x: int(x[1]), reverse=True)
sorted_sp = sorted(sorted_sp,key = itemgetter(0))

for i in range(n):
    for j in range(n):
        if sp[j] == sorted_sp[i]:
            print(j+1)

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(){
int d,n;
cin >> d>> n;
long long int ans=1;
if(d==0){
  if(n<100) cout << n<<endl;
  else {
    cout << n+1<<endl;
  }
}
else{
  for(int i=0;i<d;i++) ans*=100;
  if(n!=100) cout << ans*n<<endl;
  else cout<<ans*(n+1)<<endl;
}
}


Measured memory_bytes: 256
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}
ll mp[Max+10];

int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;

      bool flag=false;

      string str;


    cin>>n;

    ll ara[n+1];



    for(i=0; i<n; i++)
    {
        cin>>ara[i];

        sum+=ara[i];

        mp[ara[i]]++;
    }

    cin>>t;
    while(t--)
    {
      cin>>a>>b;

      sum-=(mp[a]*a);

      sum+=(mp[a]*b);

      mp[b]+=mp[a];

      mp[a]=0;

      cout<<sum<<endl;


    }















}



Measured memory_bytes: 5196
#include <iostream>
#include <cstdlib>
#include <string>
#include <typeinfo>
#include <cstring>
#include <iostream>
using namespace std;
struct Node{int key;
Node *right, *left, *parent;};
Node *root, *NIL;

Node * find(Node *u, int k){
    while(u != NIL && k != u->key){
        if(k < u->key)u = u->left;
        else u = u->right;
    }
    return u;
}

void insert(int k){
    Node *y = NIL;
    Node *x = root;
    Node *z;
    
    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;
    
    while(x != NIL){
        y = x;
        if(z->key < x->key){
            x = x->left;
        }else x = x->right;
    }
    z->parent = y;
    if(y == NIL)root = z;
    else if(z->key < y->key)y->left = z;
    else y->right = z;
}

void inorder(Node *u){
    if(u == NIL)return;
    inorder(u->left);
    cout << " " << u->key;
    inorder(u->right);
}
void preorder(Node *u){
    if(u == NIL)return;
    cout << " " << u->key;
    preorder(u->left);
    preorder(u->right);
}

int main(){
    int n,i,x;
    string com;
    
    cin >> n;
    
    for(i = 0; i < n; i++){
        cin >> com;
        if(com[0] == 'f'){
        cin >> x;
        Node *t = find(root, x);
        if(t != NIL)cout << "yes" << endl;
        else cout << "no" << endl;
        }else if(com == "insert"){
        cin >> x;insert(x);
       }else if(com == "print"){
            inorder(root);
            cout << endl;
            preorder(root);
            cout << endl;
        }
    }
    return 0;
}





Measured memory_bytes: 21908
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
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; }

int main() {
  ll n;
  cin >> n;
  rep(i, 3501) rep(j, 3501) {
    if (!i || !j)
      continue;
    double k = 1.0*i*j*n/(4*i*j-n*(i+j));
    if (k > 0 && k == (ll)k) {
      cout << i << ' ' << j << ' ' << (ll)k << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool v[10+5];
int p;
void judge(int x)
{
	p = x;
	while(v[p%10] == false && p)
		p /= 10;
	if(p != 0)
	{
		judge(x+1);
		return;
	}
	else
	{
		printf("%d", x);
		exit(0);
	}
}
int main()
{
	int n, k;
	scanf("%d%d", &k, &n);
	for(int i=1; i<=n; i++)
	{
		int x;
		scanf("%d", &x);
		v[x] = true;
	}
	judge(k);
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		List<Integer> dataset = new ArrayList<Integer>();
		while(sc.hasNextLine())
		{
			String[] splitted = sc.nextLine().split("\\s+");
			dataset.add(Integer.parseInt(splitted[0]) + Integer.parseInt(splitted[1]));
		}
		
		for(int i = 0; i < dataset.size(); ++i)
		{
			System.out.println(DigitOf(dataset.get(i)));
		}
	
	}
	
	public static int DigitOf(Integer num)
	{
		if(num < 10)
		{
			return 1;
		}
		else
		{
			return 1 + DigitOf(num/10);
		}
	}
} 

Measured memory_bytes: 17496
#include<stdio.h>
#include<string.h>
#include<queue>
using namespace std;
int a[11000];
int s[110][110];
int h,w,n;

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

queue<int>v;
void dfs(){
	int i=0,j=0;
	
	int k=0;int pos=0;
	for(i=0;i<h;i++){
		if(i%2){
			for(j=0;j<w;j++){
				s[i][j]=v.front();
				v.pop();
			}
		}else{
			for(j=w-1;j>=0;j--){
				s[i][j]=v.front();
				v.pop();
			}
		}
		
	}
	
}

int main(){
	int t;
	
	scanf("%d %d",&h,&w);
	scanf("%d",&n);
	
	for(int i=0;i<n;i++){
		scanf("%d",&t);
		while(t>0){
			v.push(i+1);
			t--;
		}
	}
	memset(s,0,sizeof(s));
	
	dfs();
	
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(j)printf(" ");
			printf("%d",s[i][j]);
		}
		printf("\n");
	}
	
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    int m;cin>>m;
    cout<<48-m<<endl;
}


Measured memory_bytes: 256
M,K = map(int,input().split())
if [M,K] == [1,1] or K>=2**M:
    print(-1)
elif [M,K] == [1,0]:
    print('0 0 1 1')
else:
    ans = []
    for i in range(2**M):
        if i != K:
            ans.append(i)
    ans = ans+[K]+ans[::-1]+[K]
    print(*ans)

Measured memory_bytes: 69616
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)

	a := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&a[i])
	}

	m := make(map[int]int)

	for _, v := range a {
		m[v]++
	}

	var isNO bool
	for _, v := range m {
		if v > 1 {
			fmt.Println("NO")
			isNO = true
			break
		}
	}
	if !isNO {
		fmt.Println("YES")
	}
}


Measured memory_bytes: 14208
#include<bits/stdc++.h>
#define int long long
using namespace std;
int x[50005],y[50005],mp[50005],tot=31;
int xx[4]={0,0,1,-1};
int yy[4]={1,-1,0,0};
char s[4]={'U','D','R','L'};
void work(int x,int y)
{
	for(int i=1;i<=tot;i++)
	{
		int minn=1e18,mn;
		for(int j=0;j<4;j++)
		{
			int sum=abs(x-xx[j]*mp[i])+abs(y-yy[j]*mp[i]);
			if(sum<minn) minn=sum,mn=j;
		}
		x-=xx[mn]*mp[i],y-=yy[mn]*mp[i];
		printf("%c",s[mn]);
	}
	printf("\n");
}
signed main()
{
	int n;
	scanf("%lld",&n);
	for(int i=1;i<=n;i++) scanf("%lld%lld",x+i,y+i);
	for(int i=1;i<=n;i++)
	{
		
		if(((x[i]+y[i])&1!=((x[i-1]+y[i-1])&1))&&i!=1)
		{
			printf("-1\n");
			return 0;
		}
	}
	for(int i=1;i<=31;i++) mp[i]=1<<(31-i);
	if(((x[1]+y[1])&1)==0) mp[++tot]=1;
	printf("%lld\n",tot);
	for(int i=1;i<=tot;i++) printf("%lld ",mp[i]);printf("\n");
	for(int i=1;i<=n;i++) work(x[i],y[i]);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define endl "\n"
#define mod 1000000007
// #define M_PI 3.141592653590
#define ps(x,noOfDecimal) fixed<<setprecision(noOfDecimal)<<x

using namespace std;

long double calc(long double h, long double m)
{
    long double ha = 0.5 * (h * 60 + m);
    long double ma = 6 * m;
    long double an = abs(ha - ma);
    an = min(360 - an, an);
    return an;
}

signed main()
{
    if (fopen("input.txt", "r")) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    }
    std::ios::sync_with_stdio(false);
    int t = 1;
    // cin >> t;
    while (t--) {
        long double a, b, h, m;
        cin >> a >> b >> h >> m;
        long double x = sqrt(a * a + b * b - 2 * a * b * cos( M_PI * (calc(h, m)) / 180));
        cout << ps(x, 10);
    }
    return 0;
}

Measured memory_bytes: 4116
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
using namespace std;
const int N=10;
int x,y,rd[N],cnt[N];
int main(){
	rep (i,1,3) scanf("%d%d",&x,&y),rd[x]++,rd[y]++;
	rep (i,1,4) cnt[rd[i]]++;
	if (cnt[1]==2&&cnt[2]==2) puts("YES"); else puts("NO");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<queue>
#include<stack>
#include<iomanip>
#include<cstring>
#include<string>
#include<set>

#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll = long long int;

const ll INF = 1<<30;
const ll LINF = 1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(void) {
    int a; cin >> a;
    cout << a + a * a + a * a * a << endl;
}

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

using namespace std;

#define LOG(...) fprintf(stderr,__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(a) ((int)(a).size())
#define BIT(x, i) (((x) >> (i)) & 1)

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

int main() {
    int e;
    while (cin >> e, e) {
        int m = 1000000;
        for (int y = 0; y*y <= e; y++)
        for (int z = 0; y*y + z*z*z <= e; z++) {
            int x = e - y*y - z*z*z;
            if (m > x + y + z) {
                m = x + y + z;
            }
        }
        cout << m << endl;
    }
}

Measured memory_bytes: 3060
#include<iostream>
#include<iomanip>
#include<string>
#include<array>
#include<cmath>
#include<vector>
#include<utility>
#include<algorithm>
#include<ctype.h>
using namespace std;


int main() {
	int n;
	cin >> n;
	cout << n / 3 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#include <cstdint>
#include <numeric>
#define INF 1000000000
#define LLINF 2000000000000000
#define MOD 1000000007
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
#define int long long

int pow5(int n){
  return n*n*n*n*n;
}

signed main(){
    int x;
    cin >> x;
    FOR(a, -1000, 1000){
      FOR(b, -1000, 1000){
        if(pow5(a)-pow5(b)==x){
          cout << a << " " << b << endl;
          return 0;
        }
      }
    }
    return 0;
}


Measured memory_bytes: 3636