akhauriyash/Code-Regression huggingface dataset:
macro_rules! get {
      ($t:ty) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.trim().parse::<$t>().unwrap()
          }
      };
      ($($t:ty),*) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              let mut iter = line.split_whitespace();
              (
                  $(iter.next().unwrap().parse::<$t>().unwrap(),)*
              )
          }
      };
      ($t:ty; $n:expr) => {
          (0..$n).map(|_|
              get!($t)
          ).collect::<Vec<_>>()
      };
      ($($t:ty),*; $n:expr) => {
          (0..$n).map(|_|
              get!($($t),*)
          ).collect::<Vec<_>>()
      };
      ($t:ty ;;) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.split_whitespace()
                  .map(|t| t.parse::<$t>().unwrap())
                  .collect::<Vec<_>>()
          }
      };
      ($t:ty ;; $n:expr) => {
          (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
      };
}

fn main() {
    let a = get!(i32);
    let s = get!(String);
    println!("{}", if a < 3200 {
        "red"
    } else {
        &s
    });
}


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

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

int main()
{
	ll A, B, C;
	cin >> A >> B >> C;

	bool find = false;
	if (C % GCD(A, B) == 0)
	{
		find = true;
	}

	
	if (find) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

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

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

//typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1

int main(){
    int n;
    int m;
    bool ok=false;
    cin >> n >> m;;
    vector<vector<int>> ab(n);
    int a;
    int b;
    for(int i=0; i<m; i++){
        cin >> a >> b;
        a--;
        b--;
        ab[a].push_back(b);
    }

    for(int i=0; i<ab[0].size(); i++){
        int tmp=ab[0][i];
        for(int j=0; j<ab[tmp].size(); j++){
            if(ab[tmp][j]==n-1){
                ok=true;
            }
        }
    }

    if(ok==true){
        cout << "POSSIBLE" << endl; 
    }else{
        cout << "IMPOSSIBLE" << endl;
    }

    return 0;
}


Measured memory_bytes: 8576
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S ;
  cin >> S;
  
  if (S.at(0) == 'A' && S.at(1) == 'A' && S.at(2) == 'A' ) {
    cout << "No" << endl;
  }else if (S.at(0) == 'B' && S.at(1) == 'B' && S.at(2) == 'B' ){
  	cout << "No" << endl;
  }else if (S.at(0) == 'A' && S.at(1) == 'B' && S.at(2) == 'A' ){
  	cout << "Yes" << endl;
  }else if (S.at(0) == 'B' && S.at(1 )== 'A' && S.at(2) == 'A' ){
  	cout << "Yes" << endl;
  }else if (S.at(0) == 'A' && S.at(1) == 'A' && S.at(2) == 'B' ){
  	cout << "Yes" << endl;
  }else if (S.at(0) == 'B' && S.at(1) == 'B' && S.at(2) == 'A' ){
  	cout << "Yes" << endl;
  }else if (S.at(0) == 'A' && S.at(1) == 'B' && S.at(2) == 'B' ){
  	cout << "Yes" << endl;
  }else if (S.at(0) == 'B' && S.at(1) == 'A' && S.at(2) == 'B' ){
  	cout << "Yes" << endl;
  }else{
  	cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char* argv[]) {
  long long N;
  cin >> N;

  if (N < 10) {
    cout << N << endl;
    return 0;
  }

  string s = to_string(N);

  for (int i = 1; i < s.size(); ++i) {
    if (s[i] != '9') {
      long long ret = 0;
      int n = 1;
      if (i - 1 == 0)
        ret += s[0] - '0' - 1;
      else {
        ret += s[i - 1] - '0' - 1;
        ret += s[0] - '0';
        n = 2;
      }
      ret += 9 * (s.size() - n);
      cout << ret << endl;
      return 0;
    }
  }

  long long ret = s[0] - '0' + 9 * (s.size() - 1);
  cout << ret << endl;

  return 0;
}

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

class Program {

	public void Proc() {
		string[] inpt = Console.ReadLine().Split(' ');
		int[,] array = new int[int.Parse(inpt[0]), int.Parse(inpt[1])];
		for (int i = 0; i < int.Parse(inpt[2]); i++) {
			string[] inpt2 = Console.ReadLine().Split(' ');
			switch (int.Parse(inpt2[2])) {
				case 1:
					array = Test1(array, int.Parse(inpt2[0]), int.Parse(inpt2[1]));
					break;
				case 2:
					array = Test2(array, int.Parse(inpt2[0]), int.Parse(inpt2[1]));
					break;
				case 3:
					array = Test3(array, int.Parse(inpt2[0]), int.Parse(inpt2[1]));
					break;
				case 4:
					array = Test4(array, int.Parse(inpt2[0]), int.Parse(inpt2[1]));
					break;
			}
		}

		int ans = GetAnswer(array, int.Parse(inpt[0])*int.Parse(inpt[1]));
		Console.WriteLine(ans);
	}

	public static int[,] Test1(int[,] array, int x, int y) {
		int ylen = array.GetLength(1);
		for (int i = 0; i < ylen; i++) {
			for(int j = 0; j < x; j++) {
				array[j,i] = 1;
			}
		}
		return array;
	}

	public static int[,] Test2(int[,] array, int x, int y) {
		int xlen = array.GetLength(0);
		int ylen = array.GetLength(1);
		for (int i = 0; i < ylen; i++) {
			for(int j = x; j < xlen; j++) {
				array[j,i] = 1;
			}
		}
		return array;
	}

	public static int[,] Test3(int[,] array, int x, int y) {
		int xlen = array.GetLength(0);
		for (int i = 0; i < y; i++) {
			for(int j = 0; j < xlen; j++) {
				array[j,i] = 1;
			}
		}
		return array;
	}

	public static int[,] Test4(int[,] array, int x, int y) {
		int xlen = array.GetLength(0);
		int ylen = array.GetLength(1);
		for (int i = y; i < ylen; i++) {
			for(int j = 0; j < xlen; j++) {
				array[j,i] = 1;
			}
		}
		return array;
	}

	public static int GetAnswer(int[,] array, int areaSize) {
		int cnt = 0;
		foreach(int i in array) {
			if (i == 1) {
				cnt++;
			}
		}
		return areaSize - cnt;
	}

	static void Main(string[] args) {
		Program prg = new Program();
		prg.Proc();
	}
}


Measured memory_bytes: 2776
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;
const int inf = 1000000000; //10^9
const ll MOD = 1e9 + 7;
//加算代入演算子は+=！！！！！
//int 2^31 10^9まで
//intは10桁、long longは18桁、doubleは308桁、long double は4932桁

const ll MX = 1e18; //1(1倍)e(指数)18(10^18)

int main()
{
    int n;
    cin >> n;
    ll ans = 1;
    bool ng = false;
    rep(i, n)
    {
        ll a;
        cin >> a;
        if (a == 0) //0が一個でもあったら
        {
            cout << 0 << endl;
            return 0;
        }
        if (__int128(ans) * a > MX) //0^18を超えたらng=true。__int128()で128bitの整数対応（多倍長整数）
        {
            ng = true; // 0がないかひととおり確認しなきゃいけないからbreakしちゃだめ
        }
        ans *= a;
    }
    if (ng)
        cout << -1 << endl;
    else
        cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // fixed, setprecision 
#include <math.h> // double sqrt
#define rep(i,n) for(int i=0;i<(n);++i)
#define ll long long
using namespace std;
int main(){
    int n,a,b;
    cin>>n>>a>>b;
    vector<int>p(n);
    rep(i,n)cin>>p[i];
    int x=0,y=0,z=0;
    rep(i,n){
        if(p[i]<=a){x++;continue;}
        if(p[i]>=a+1&&p[i]<=b){y++;continue;}
        if(p[i]>=b+1) z++;
    }
cout<<min(min(x,y),z);
}


Measured memory_bytes: 3192
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	//数値の入力
		int n = sc.nextInt();
  	    int m = sc.nextInt();
      	//配列
        int K[] = new int[n];
      	int A[][] = new int[n][m]; 
      	int fav[] = new int[m];
      	int count = 0;
        for(int i = 0; i < n; i++){
         	K[i] = sc.nextInt();
          for(int j = 0; j < K[i] ; j++){
        	A[i][j] = sc.nextInt();
            //m=1~4⇒添え字0~3の配列に格納
			fav[A[i][j] - 1] += 1;
     	   }
        }
      	for(int i = 0; i < m; i++){
        if(fav[i] ==n){
          count = count+1;
        }
         }
       	 System.out.println(count);
     }
}

Measured memory_bytes: 38556
def walking():
    x, k, d = map(int, input().split())
    x = abs(x)
    r = 0
    if x > k * d:
        return x - k * d
    else:
        r = x//d
        if (k - r)%2 == 0:
            return x - r * d
        else:
            return abs(x - (r + 1 ) * d)
    
loc = walking()
print(loc)

Measured memory_bytes: 61872
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
int main()
{
    string s;
    cin>>s;
    if(s[0]==s[2])
    {
    	cout<<"Yes"<<endl;
    }
    else
    {
    	cout<<"No"<<endl;
    }
    return 0;
}

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

int main() {
    string n;
    cin >> n;
    
    int sum = 0;
    for(int i = 0; i < n.length(); i++){
        char a = n[i];
        sum += (int)a - 48;
    }
    
    if(sum % 9 == 0){
        cout << "Yes" << endl;
    }else cout << "No" << endl;
}

Measured memory_bytes: 3672
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
using namespace std;

int gcd(int a,int b)
{
	if (a%b==0)
	{
		return(b);
    }
	else
	{
		return(gcd(b,a%b));
    }
}

int main()
{
  int N;
  cin>>N;
  vector <int> A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  int ans = A[0];
  for(int i=1;i<N;i++){
    ans=gcd(ans,A[i]);
  }
  cout<< ans <<endl;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
 
using namespace std;
int main(void)
{
  int n;
  cin >> n;
  
  vector<int> h;
  for(int i=0; i<n; i++){
      int tmp;
      cin >> tmp;
      h.push_back(tmp);
  }

  int cnt = 0;
  int ptr = 0;
  while(count(h.begin(), h.end(), 0)!=n){
      cnt++;
      while(h[ptr]==0)
        ptr++;
        
      while(h[ptr] !=0){
        h[ptr]--;
        ptr++;
        
        if(ptr==n)
          break;
      }
      ptr=0;
  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
   int W,H,x,y,r;
   cin >> W;
   cin >> H;
   cin >> x;
   cin >> y;
   cin >> r;
if( x-r>=0 && x+r <= W && y-r >= 0 && y+r <= H){
    cout << "Yes";
}else{
    cout << "No";
}
 cout << endl;
}



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

int main(void) {
  int n;
  string s;
  cin >> n >> s;
  vector<int> wtoe(n, 0);
  vector<int> etow(n, 0);
  for (int i = 1; i < n; i++) {
    wtoe[i] = wtoe[i - 1] + (s[i - 1] == 'W' ? 1 : 0);
    etow[n - i - 1] = etow[n - i] + (s[n - i] == 'E' ? 1 : 0);
  }

  for (int i = 0; i < n; i++) {
    wtoe[i] += etow[i];
  }

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

  cout << wtoe[0] << endl;
  return 0;
}

Measured memory_bytes: 6152
unittest
{
	assert( [ "-9" ].solve == "1011" );
	assert( [ "123456789" ].solve == "11000101011001101110100010101" );
	assert( [ "0" ].solve == "0" );
}



import std.conv;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	
	if( n == 0 ) return "0";
	
	// -2進数表記での桁数を計算
	auto i = 0L;
	auto ms = [ 0L ];
	auto ps = [ 0L ];
	for( auto d = 1L; n < ms.back || ps.back < n; i++, d *= -2 )
	{
		ms ~= ms.back;
		ps ~= ps.back;
		if( d < 0 ) ms.back += d;
		else        ps.back += d;
	}
	
	// 上から順に桁を計算
	auto anss = new char[ i ];
	for( auto j = i - 1, d = ( -2L ) ^^ j; 0 <= j; j--, d /= -2 )
	{
		auto x = n - d;
		if( ms[ j ] <= x && x <= ps[ j ] )
		{
			n = x;
			anss[ $ - 1 - j ] = '1';
		}
		else
		{
			anss[ $ - 1 - j ] = '0';
		}
	}
	return anss.idup;
}


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

using namespace std;

long a[222222];
int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		scanf("%ld", a + i);
		a[i] += a[i - 1];
	}
	sort(a, a + n + 1);
	long r = 0, m = 0;
	for (int i = 1; i <= n; i++) {
		if (a[i] != a[i - 1])
			m = 0;
		else m++;
		r += m;
	}
	cout << r << endl;
	return 0;
}


Measured memory_bytes: 1792
import sys
sys.setrecursionlimit(10 ** 7)

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# 複数回出てきているところが問題、グラフ問題として連結した部分で判定
N, M = lr()
adjacent = [[] for _ in range(N+1)] # 1-indexed
for _ in range(M):
    l, r, d = lr()
    adjacent[l].append((r, d))
    adjacent[r].append((l, -d))

X = [None] * (N+1)
used = set()

def check(i):
    global used
    used.add(i)
    if X[i] == None: X[i] = 0
    for target, dist in adjacent[i]:
        if X[target] != None and X[target] != X[i] + dist:
            print('No')
            exit()
        if target in used:
            continue
        else:
            X[target] = X[i] + dist
            check(target)

for i in range(1, N+1):
    check(i)

print('Yes')
# 54

Measured memory_bytes: 137980
#include<bits/stdc++.h>
#define ll long long
using namespace std;

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

    //good luck kittu!
    int n, k, x, y; cin>>n>>k>>x>>y;
    int ans = x*min(k, n);
    n -= min(k, n);
    ans += n*y;
    cout<<ans<<'\n';
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
using namespace std;


int main() {

	long A, B, K;
	cin >> A >> B >> K;

	long cnt = 0;
	long base = min(A, B) + 1;

	while (cnt < K) {
		base--;
		if (0 == A % base && 0 == B % base) {
			cnt++;
		}
	}

	cout << base << endl;

	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <regex>
#include <iomanip>
#include <climits>
#include <utility>
#include <queue>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;
const dd PI = 3.1415926435;

class UnionFind
{
public:
    UnionFind(int N) : par(N)
    {
        for (ll i = 0; i < N; i++)
        {
            par[i] = i;
        }
    }

    int root(int x)
    {
        if (par[x] == x)
            return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry)
            return;
        par[rx] = ry;
    }

    bool same(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

private:
    vector<int> par;
};

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

ll fact(ll n)
{
    if (n == 0)
    {
        return 1;
    }
    if (n == 1)
    {
        return 1;
    }
    return n * fact(n - 1) % MOD;
}

ll pow_fast(ll n, ll k)
{
    if (k == 0)
    {
        return 1;
    }
    if (k == 1)
    {
        return n;
    }

    if (k % 2 == 0)
    {
        ll tmp = pow_fast(n, k / 2LL);
        return tmp * tmp % MOD;
    }
    else
    {
        ll tmp = pow_fast(n, k / 2LL);
        tmp *= tmp;
        tmp %= MOD;
        return tmp * n % MOD;
    }
}

map<ll, ll> sosuu(ll n)
{
    map<ll, ll> res;
    for (ll i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            res[i] += 1;
            n /= i;
        }
    }
    if (n != 1)
    {
        res[n] += 1;
    }
    return res;
}

struct Dish{
    ll time;
    ll taste;
};
int main()
{
    string N;
    cin >> N;

    ll sum = 0;
    for (ll i = 0; i < N.size(); i++)
    {
        sum += N[i] - '0';
    }
    cout << (stoi(N) % sum == 0 ? "Yes" : "No") << endl;
}

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

int main() {
  int K, X; cin >> K >> X;

  rep( i, X-K+1, X+K ) cout << i << ' ';
  cout << endl;
}


Measured memory_bytes: 256
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;

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

#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

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

#define FOREACH(x,a) for(auto& (x) : (a) )

#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])

#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl

#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl

#define ALL(obj) (obj).begin(),(obj).end()

#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__);
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__);


#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define L list<int>

#define pb(a) push_back(a)
#define mp make_pair


int main(){

    SCIN(x,y);
    if(x==y)COUT("=");
    else
    SANKOU(x<y,<,>);
    




    return 0;
}


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

int main(){
  int H,W;
  cin >> H >> W;
  
  string s[H];
  rep(i,H) cin >> s[i];

  int dx[8]={-1,-1,0,1,1,1,0,-1};
  int dy[8]={0,1,1,1,0,-1,-1,-1};
  vector<int> b;
  string t[H];
  rep(k,H)rep(i,W){
    if(s[k][i]=='#')t[k].pb('#');
    else{
      int bomb=0;
      rep(j,8){
	if(k+dy[j]>=0 && k+dy[j]<H && i+dx[j]>=0 && i+dx[j]<W){
	  if(s[k+dy[j]][i+dx[j]]=='#') bomb+=1;
	}
      }
      
      b.pb(bomb);
    }   
  }
  int  x=0;
  rep(i,H){
    rep(j,W){
      if(s[i][j]=='#') cout << "#";
      else{
	cout << b[x];
	x++;
      }
    }
    cout <<""<<endl;
  }


  return 0;

}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline


def read():
    _, _, M = map(int, input().strip().split())
    A = list(map(int, input().strip().split()))
    B = list(map(int, input().strip().split()))
    XYC = []
    for i in range(M):
        x, y, c = map(int, input().strip().split())
        XYC.append((x, y, c))
    return A, B, M, XYC


def solve(A, B, M, XYC):
    min_cost = min(A) + min(B)
    for x, y, c in XYC:
        cost = A[x-1] + B[y-1] - c
        min_cost = min(min_cost, cost)
    return min_cost


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


Measured memory_bytes: 29624
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

int main(){
    int n, x;
    cin >> n >> x;
    int m[n];
    int m_min = 100001;
    for(int i = 0; i < n; i++){
        cin >> m[i];
        x -= m[i];
        m_min = min(m_min, m[i]);
    }
    int ans = n + x / m_min;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
        int a,b;
	scanf("%d %d",&a,&b);
	if(a==b){
	 printf("a == b\n");
        }
        else if(a>b){
         printf("a > b\n");
        }
        else{
         printf("a < b\n");
        }
	return 0;
}

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

int c1, c5, c10, c50, c100, c500;
int sum = 0;

int main(void)
{
	cin >> c1 >> c5 >> c10 >> c50 >> c100 >> c500;

	sum = c1 + 5*c5 + 10*c10 + 50*c50 + 100*c100 + 500*c500;

	if (sum >= 1000) cout << 1 << endl;
	else cout << 0 << endl;
	
	return 0;
}

Measured memory_bytes: 1164
c = [list(map(int, input().split())) for _ in range(3)]
flg = True
s = sum(c[0]) % 3
t = sum(c[i][0] for i in range(3)) % 3
for i in range(1, 3):
  if sum(c[i]) % 3 != s:
    flg = False
  if sum(c[j][i] for j in range(3)) % 3 != t:
    flg = False
if flg:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9188
h,w,m = list(map(int,input().split()))

bombDict = dict()
bombDictH = dict()
bombDictW = dict()


for i in range(h+1):
    bombDict[i] = set()
    bombDictH[i] = 0

for i in range(w+1):
    bombDictW[i] = 0


for i in range(m):
    bombH,bombW = list(map(int,input().split()))
    bombDictH[bombH] += 1
    bombDictW[bombW] += 1
    bombDict[bombH].add(bombW)

maxH = max(bombDictH,key = bombDictH.get)
maxW = max(bombDictW,key = bombDictW.get)
maxHV = max(bombDictH.values())
maxWV = max(bombDictW.values())

hList = list(bombDictH.values())
wList = list(bombDictW.values())

maxHList = []
maxWList = []

if hList.count(maxHV) > 1:
    for i in range(h+1):
        if hList[i] == maxHV:
            maxHList.append(i)
else:
    maxHList.append(maxH)

if wList.count(maxWV) > 1:
    for i in range(w+1):
        if wList[i] == maxWV:
            maxWList.append(i)
else:
    maxWList.append(maxW)

ans = 0

for i in maxHList:
    for j in maxWList:
        if j in bombDict[i]:
            ans = max(ans,bombDictH[i] + bombDictW[j] - 1)
        else:
            ans = max(ans,bombDictH[i] + bombDictW[j])
            break

print(ans)

Measured memory_bytes: 211660
#include<cstdio>
#include<cstring>
#include<algorithm>
typedef long long LL;
using namespace std;
#define max_n 100005
 
int a[max_n];
 
int main()
{
	int n,k=1,ans,i;
	bool flag,res=false;
	scanf("%d",&n);
	scanf("%d",&a[0]);
	if(n==1)
	{
		printf("1\n");
		return 0;
	}
	ans=a[0];
	for(i=1;i<n;i++)
	{
		scanf("%d",&a[i]);
		if(!res)
		{
			if(a[i]>ans)
			{
				flag=true;
				res=true;
				ans=a[i];
			}
			else if(a[i]<ans)
			{
				flag=false;
				res=true;
				ans=a[i];
			}
		}
		else
		{
			if(flag)
			{
				if(a[i]>=ans)
					ans=a[i];
				else
				{
					k++;
					ans=a[i];
					res=false;
				}
			}
			else
			{
				if(a[i]<=ans)
					ans=a[i];
				else
				{
					k++;
					ans=a[i];
					res=false;
				}
			}
		}
	}
	printf("%d\n",k);
	return 0;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        
        while(true){
            
            int n1 = sc.nextInt();
            String op = sc.next();
            int n2 = sc.nextInt();
            if("+".equals(op)){
                System.out.println(n1+n2);
            }else if("-".equals(op)){
                System.out.println(n1-n2);
            }else if("/".equals(op)){
                System.out.println(n1/n2);
            }else if("*".equals(op)){
                System.out.println(n1*n2);
            }else {
                break;
            }
        }
    }
}



Measured memory_bytes: 26152
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <limits>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <fstream>
#include <iterator>
#include <random>
#include <chrono>

 
#define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
#define set_map_includes(set, elt) (set.find((elt)) != set.end())
#define readint(i) int i; cin >> i
#define readll(i) ll i; cin >> i
#define readdouble(i) double i; cin >> i
#define readstring(s) string s; cin >> s
 
typedef long long ll;
 
using namespace std;

ll modd = 1000*1000*1000+7;


int main()   {

    ios_base::sync_with_stdio(false);

    cout.precision(17);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> rand_gen(0, modd);   // rand_gen(rng) gets the rand no

//    auto start = chrono::steady_clock::now();
  
//    readint(test_cases);
    int test_cases = 1;
    forr(t, 1, test_cases) {
        readint(k);
        int ret = 1, x = 7;
        while (ret < k+8) {
            if (x%k==0) {  break;  }
            ret++;
            x = (10*x + 7) % k;
        }
        if (ret == k+8) {ret = -1;}
        cout << ret << endl;

//        cout << "Case #" << t << ": " << endl;
    }
 
//    auto end = chrono::steady_clock::now();
//    cout << chrono::duration_cast<chrono::milliseconds>(end - start).count() << endl;

    return 0;
}

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

// ダイクストラ法
// 負の辺を持たないこと。

#define UNDIRECTED // 無向グラフ

using ll = long long;

constexpr int MAX_V = 1e5;
constexpr ll INF = 1e18 + 7;

using P = pair<ll, int>; // ソートを考慮して(コスト,頂点)

struct Edge {
  int to;
  int yen;
  int snuke;
};

int V;
vector<Edge> graph[MAX_V];
array<ll, MAX_V> yen;
array<ll, MAX_V> snuke;

void dijkstra(int s, array<ll, MAX_V> &dist) {
  fill_n(dist.begin(), MAX_V, INF);
  dist[s] = 0;

  priority_queue<P, vector<P>, greater<P>> que;
  que.push({dist[s], s});

  while (!que.empty()) {
    P p{que.top()};
    que.pop();
    int from{p.second};
    if (dist[from] < p.first)
      continue;
    for (size_t i{}; i < graph[from].size(); ++i) {
      Edge e{graph[from][i]};
      if (dist[e.to] > dist[from] + e.yen) {
        dist[e.to] = dist[from] + e.yen;
        que.push({dist[e.to], e.to});
      }
    }
  }
}

void dijkstra_snuke(int s, array<ll, MAX_V> &dist) {
  fill_n(dist.begin(), MAX_V, INF);
  dist[s] = 0;

  priority_queue<P, vector<P>, greater<P>> que;
  que.push({dist[s], s});

  while (!que.empty()) {
    P p{que.top()};
    que.pop();
    int from{p.second};
    if (dist[from] < p.first)
      continue;
    for (size_t i{}; i < graph[from].size(); ++i) {
      Edge e{graph[from][i]};
      if (dist[e.to] > dist[from] + e.snuke) {
        dist[e.to] = dist[from] + e.snuke;
        que.push({dist[e.to], e.to});
      }
    }
  }
}

int main() {
  int E, s, t;
  cin >> V >> E >> s >> t;
  --s, --t;
  for (int i{}; i < E; ++i) {
    int from, to, yen, snuke;
    cin >> from >> to >> yen >> snuke;
    --from, --to;
    graph[from].push_back({to, yen, snuke});
#ifdef UNDIRECTED
    graph[to].push_back({from, yen, snuke});
#endif
  }

  dijkstra(s, yen);
  dijkstra_snuke(t, snuke);

  vector<ll> ans(V);
  int i{V - 1};
  ans[i] = yen[i] + snuke[i];
  for (--i; i >= 0; --i) {
    ans[i] = min(ans[i + 1], yen[i] + snuke[i]);
  }
  for (int i{}; i < V; ++i) {
    cout << static_cast<ll>(1e15) - ans[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 10692
#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <queue>
#include <set>
#include <complex>
#include <algorithm>
#include <cassert>
#include <iterator>
#include <numeric>

using namespace std;

typedef long double ld;
typedef long long ll;
typedef pair<ll, ll> P;

const ll INF = 1e15;
const double eps = 1e-6;
const ll MOD = 1000000007;

int main() {
	ll N, A, B;
	cin >> N >> A >> B;
	bool rev = B > A;
	if (rev)
		swap(A, B);
	if (A + B > N + 1 || (A != N && B == 1)) {
		cout << -1 << endl;
		return 0;
	}
	vector<ll> ans;
	for (ll k = N - A + 1; k <= N;k++)
		ans.push_back(k);
	ll rest = N - A;
	ll now = 1;
	while (rest - A + 1 >= B - now && rest > 0) {
		for (ll k = max(1LL, rest - A + 1);k <= rest;k++)
			ans.push_back(k);
		rest -= A;
		now++;
		if (rest < 0)
			break;
	}
	if (rest < 0 || now + (rest > 0) > B) {
		cout << -1 << endl;
		return 0;
	}
	for (ll k = max(1LL, rest - (now + rest - B));k <= rest;k++)
		ans.push_back(k);
	rest = rest - (now + rest - B) - 1;
	for (ll k = rest;k >= 1;k--)
		ans.push_back(k);
	if (rev) {
		for (int i = 0;i < ans.size();i++)
			ans[i] = N + 1 - ans[i];
	}
	for (int i = 0;i < ans.size();i++) {
		cout << ans[i];
		if (i == ans.size() - 1)
			cout << endl;
		else
			cout << " ";
	}
	return 0;
}


Measured memory_bytes: 6256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

data = np.fromstring(read(), np.int64, sep=' ')

N, K  = data[:2]
P = np.hstack([[0], data[2:] + 1])

Pcum = P.cumsum()
x = Pcum[K:] - Pcum[0:-K]
print(x.max() / 2)


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

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

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

#define DEBUG

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

// https://beta.atcoder.jp/contests/abc064/tasks/abc064_b

int main() {
    int N; cin >> N;
    int min = INF;
    int max = 0;
    int a = 0;
    REP(i, N) {
        cin >> a;
        min = std::min(min, a);
        max = std::max(max, a);
    }

    cout << max - min << "\n";

    return 0;
}


Measured memory_bytes: 256
const lines=readlines()
const N,M=map(x->parse(Int,x),split(shift!(lines)))
const G=[Pair{Int,Int}[] for _=0:N]
const B=Int[]
function lb(A,x)
	L=0
	R=length(A)+1
	while R-L>1
		M=div(L+R,2)
		if A[M]<x
			L=M
		else
			R=M
		end
	end
	R
end
const vis=zeros(Bool,N+1)
const ans=Int[]
function dfs(u)
	vis[u]=true
	c=B[u]
	for (v,i)=G[u]
		if vis[v]
			continue
		end
		if dfs(v)
			push!(ans,i)
			c+=1
		end
	end
	c%2==1
end
function main()
	AB=Pair{Int,Int}[]
	for i=1:N
		a,b=map(x->parse(Int,x),split(shift!(lines)))
		push!(AB,a=>b)
	end
	sort!(AB)
	A=[a for (a,b)=AB]
	for i=1:N+1
		l=i==1 ? 0 : AB[i-1].second
		r=i==N+1 ? 0 : AB[i].second
		push!(B,l!=r ? 1 : 0)
	end
	for i=1:M
		l,r=map(x->parse(Int,x),split(shift!(lines)))
		l=lb(A,l)
		r=lb(A,r+1)
		if l<r
			push!(G[l],r=>i)
			push!(G[r],l=>i)
		end
	end
	for i=1:N+1
		if !vis[i]&&dfs(i)
			println(-1)
			exit()
		end
	end
	println(length(ans))
	println.(sort(ans))
end
main()


Measured memory_bytes: 196028
#include <cstdio>
#include <list>
#include <algorithm>
using namespace std;

int main(){
	int q,x,i=0;
	char c[20];
	list<int> link;
	list<int>::iterator it;
	scanf("%d",&q);
	while(q--){
		scanf("%s",c);
		if(c[0]=='i'){
			scanf("%d",&x);
			link.push_front(x);
		}else if(c[6]=='F'){
			link.pop_front();
		}else if(c[6]=='L'){
			link.pop_back();
		}else if(c[0]=='d'){
			scanf("%d",&x);
			for(it=link.begin();it != link.end();it++){
				if(*it == x){
					link.erase(it);
					break;
				}
			}
		}
	}
	for(it=link.begin();it!=link.end();it++){
		if(i++) printf(" ");
		printf("%d",*it); 
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 33884
#include<iostream>
#include<unordered_map>
#include<bitset>
#include<math.h>
#include<vector>
#include<set>
#include<algorithm>
#include<ctype.h>
#include<unordered_set>
#include<string>
#include<iomanip>
#include<queue>
#include<limits>
#include<map>
#include<stack>
#include<iterator>
#include<cstring>
 
#include<deque>
#define pi 3.141592653589793238
#include<chrono>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define MOD 1000000007
#define INF 999999999999999999 
#define pb push_back
#define ff first
#define ss second
 
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
 
 
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    ll T = 1, i, j;
    
    //cin >> T;
    while (T--) {
        ll n;
        cin >> n;
        bitset<10001> b;
        b[0] = 1;
        for(i = 0; i < n; i++){
            ll x;
            cin >> x;
            b = (b | (b << x));
        }
        ll ans = 0;
        for(i = 10000; i >= 0; i--){
            if(!b[i]){
                continue;
            }
            ll val = i;
            if(val % 10 == 0){
                val = 0;
            }
            ans = max(ans, val);
        }
        cout << ans;
    }
    return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define arep(a,i,n) for(ll i=(a);i<(n);i++)
#define rep(i,n) for(ll i=0;i<(n);i++)
#define cinf(x,n) for(ll i=0;i<(n);i++)cin>>x[i];
#define coutf(x,n) for(ll i=0;i<(n);i++)cout<<x[i]<<endl;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

int main(){
	string a,b;
	cin >> a >> b;
	if(a.length()>b.length()){
		cout << "GREATER" << endl;
		return 0;
	}
	else if(a.length()<b.length()){
		cout << "LESS" << endl;
		return 0;
	}
	else{
		while(!a.empty()){
			if(a[0]>b[0]){
				cout << "GREATER" << endl;
				return 0;
			}
			else if(a[0]<b[0]){
				cout << "LESS" << endl;
				return 0;
			}
			else{
				a.erase(a.begin());
				b.erase(b.begin());
			}
		}
	}
	cout << "EQUAL" << endl;
}

Measured memory_bytes: 3412
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define mod 1000000007
#define eps 1e-6
#define ll long long
#define INF 0x3f3f3f3f
#define MEM(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define mk make_pair
#define int long long
#define pi pair<int, int>
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i,a,b) for(int i=a;i>=(b);--i)
using namespace std;
int dt[][2]= {{1,0},{-1,0},{0,1},{0,-1},{0,0}};
//typedef pair<int, int> P;
//priority_queue<int, vector<int>, greater<int> > q;

const int N = 2e5+5;
int fa[N],sz[N];
bool has[N];
int n,m;

void init()
{
    rep(i,1,n)
    {
        fa[i] = i;
        sz[i] = 1;
    }
}

int find(int x)
{
    if(fa[x] != x)fa[x] = find(fa[x]);
    return fa[x];
}


signed main()
{
   IOS;
   cin >> n >> m;
   init();
   while(m--)
   {
       int a,b;
       cin >> a >> b;
       if(find(a) == find(b))continue;
       sz[find(b)] += sz[find(a)];
       fa[find(a)] = find(b);
   }
   int ans = 0;
   rep(i,1,n)
   {
       int pos = find(i);
       if(!has[pos] && sz[pos] != 1)
       {
           ans = max(ans,sz[pos]);
       }
   }
   if(ans == 0)cout << "1";
   else cout << ans;
}


Measured memory_bytes: 12892
#include <bits/stdc++.h>
using namespace std;
const int MAXn = 1e5 + 10;

long long ar[MAXn], ar2[MAXn], n, ans, sum1, sum2;
long long hp;
vector<long long> vec;
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> ar[i];
		sum1 += ar[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> ar2[i];
		sum2 += ar2[i];
	}
	if (sum2 > sum1)
		return cout << -1,0;
	
	for (int i = 0; i < n; i++) {
		if (ar[i] >= ar2[i]) {
			vec.push_back(ar[i]-ar2[i]);
		}
		else  {
			ans++;
			hp += ar2[i] - ar[i];
		}
	}
	if (0 == hp)
		return cout << 0,0;
	sort(vec.begin(), vec.end());
	long long hp2 = 0;
	for (int i = (int)vec.size() -1; i >= 0; i--) {
		hp2 += vec[i];
		ans++;
		if (hp2 >= hp)
			return cout << ans,0;
	}
}


Measured memory_bytes: 2936
//F5で実行 Shift+F5で停止
//F9でブレークポイント
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
//Ctrl+Fn+上矢印(PageUp)で上部の大半を選択できる

int A, B;

void _main() {
	cin >> A >> B;

	if (1 <= A && A <= 9 && 1 <= B && B <= 9) {
		cout << A * B << endl;
	}
	else {
		cout << -1 << endl;
	}
}

Measured memory_bytes: 256
from math import cos,radians
a,b,h,m = map(int,input().split())
 
 
mne = (360/60)*m
hne = (360/12)*h + (30*(mne/360))

if hne == mne:
    print(abs(a-b))
    exit()
elif abs(hne - mne) == 180:
    print(a+b)
    exit()
elif hne > mne:
    theta = hne - mne
else:
    theta = mne -hne
 
theta = min(theta,360-theta)
 
t = cos(radians(theta))
print((((a**2)+(b**2))-(2*a*b*t))**(1/2))

Measured memory_bytes: 9544
#include <algorithm>
#include <iostream>
#include <string>
#include <utility>  // pair
#include <vector>

using namespace std;
using ll = long long;

const auto INF = static_cast<ll>(1e9);

ll n, m, ans;
vector<ll> a, b, c;
vector<vector<ll>> dist;

int main() {
    cin >> n >> m;
    a.resize(m); b.resize(m); c.resize(m);
    dist.resize(n); for (auto& item : dist) item.resize(n);

    for (auto i = 0; i < m; i++) {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--; b[i]--;
    }

    for (auto i = 0; i < n; i++) {
        for (auto j = 0; j < n; j++) {
            dist[i][j] = i == j ? 0 : INF;
        }
    }

    for (auto i = 0; i < m; i++) {
        dist[a[i]][b[i]] = min(dist[a[i]][b[i]], c[i]);
        dist[b[i]][a[i]] = min(dist[b[i]][a[i]], c[i]);
    }

    for (auto k = 0; k < n; k++) {
        for (auto i = 0; i < n; i++) {
            for (auto j = 0; j < n; j++) {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[j][k]);
            }
        }
    }

    ans = 0;
    for (auto i = 0; i < m; i++) {
        if (c[i] > dist[a[i]][b[i]]) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int Q = sc.nextInt();
        int[] man = new int[N];
        for (int i = 0; i < Q; i++) {
        	man[sc.nextInt() - 1]++;
        }
        for (int i = 0; i < N; i++) {
        	if (man[i] <= Q - K) {
        		System.out.println("No");
        	} else {
        		System.out.println("Yes");
        	}
        }
    }
}

Measured memory_bytes: 63512
import java.util.*;
public class Main{

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int[] data = new int[3];
		for(int i=0; i<3; i++) {
			data[i]=sc.nextInt();
		}
		int max=data[0];
		for(int i=0; i<3; i++) {
			if(data[i]>max) {
				max=data[i];
			}
		}
		int ans = (max*10)+data[0]+data[1]+data[2]-max;
		System.out.println(ans);
	}
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define int long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define rep(i,l,r) for(int i=l;i<r;i++)
#define bep(i,l,r) for(int i=l;i>=r;i--)
#define ld long double
#define ff first
#define ss second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define el '\n'
#define sz(s) s.size()
#define all(v) v.begin(),v.end()
#define mii map<int,int>
#define mr  make_pair
using namespace std;
int MOD = 1e9+7;
int inf = 1e18;
const int N = 5e5+999;
//int powmod(int a,int b) {int res=1;if(a>=mod)a%=mod;for(;b;b>>=1){if(b&1)res=res*a;if(res>=mod)res%=mod;a=a*a;if(a>=mod)a%=mod;}return res;}

signed main()
{
    io
    int tt = 1;
    //cin>>tt;
    while(tt--)
    {
      int n,r;
      cin>>n>>r;
      if(n>=10)
      {
          cout<<r<<el;
      }
      else
        cout<<r+(100*(10-n))<<el;
    }
   return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
static long[,] combs = new long[51,51];//C(a,b)を0-50まで

	static void Main()
	{
    CombsGet();
		string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
		int n = int.Parse(input[0]);
		int a = int.Parse(input[1]);
    int b = int.Parse(input[2]);
    long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    float maxAverage = 0;
    long answer = 0;
    Array.Sort(nums);
    Array.Reverse(nums);//ソート
    
    for(int i = 0; i < a; i++) maxAverage += nums[i];  
    maxAverage /= a;
    Console.WriteLine(maxAverage);

    
    if(nums[0] != nums[a-1])
    {
      long x = 1;
      for(int i = a-1; i > 0; i--)
      {
        if(nums[i] == nums[i-1]) x++;
        else break;
      }
      long y = x;
      for(int i = a-1; i < n-1; i++)
      {
        if(nums[i] == nums[i+1]) y++;
        else break;
      }
      Console.WriteLine(combs[y,x]);
    }else
    {
      long y = a;
      for(int i = a-1; i < n-1; i++)
      {
        if(nums[i] == nums[i+1]) y++;
        else break;
      }
      for(int i = a; i <= y && i <= b; i++)
      {
        answer += combs[y,i];
      }
      Console.WriteLine(answer);
    }
	}

  static void CombsGet()//50以下の組み合わせを全て求める
  {
    for(int i = 0; i <= 50; i++)
    {
      combs[i,0] = 1;
      for(int j = 1; j <= i; j++)
      {
        combs[i,j] = combs[i-1,j-1] + combs[i-1,j];
      }
    }
  }
  
}


Measured memory_bytes: 11348
#include<iostream>
#include<vector>
#include<queue>
#include <string>
#include <sstream>
#include <queue>
#include <map>
#include <algorithm>
using namespace std;

const long MOD = 1e9 + 7;
int main()
{
  long n, m;
  cin >> n >> m ;


  vector<vector<char>> a(n, vector<char>(n) );
  vector<vector<char>> b(m, vector<char>(m) );

  for (int i = 0; i < n; ++i) {
    string c;
    cin >> c;
    for (int j = 0; j < c.size(); ++j) {
      a[i][j] = c[j];
      // cout << a[i][j];
    }
  }
  for (int i = 0; i < m; ++i) {
    string c;
    cin >> c;
    for (int j = 0; j < c.size(); ++j) {
      b[i][j] = c[j];
    }
  }


  bool ans = false;
  for (int i = 0; i < n - m + 1; i++) {
    for (int j = 0; j < n - m + 1; j++) {
      bool isAlltrue = true;
      for (int k = 0; k < m; k++) {
        for (int l = 0; l < m; l++) {
          if (a[i + k][j + l] != b[k][l]){
            isAlltrue=false;
            break;
          }
        }
        if (!isAlltrue)break;
      }
      if (isAlltrue)ans = true;
      if (ans)break;
    }
    if (ans)break;
  }



  cout << (ans ? "Yes" : "No");


  return 0;
}






Measured memory_bytes: 256
while True:
    N = int(input())
    
    w=[0]*N
    h=[0]*N
    wx=[-1,0,1,0]
    hy=[0,-1,0,1]
    
    if N == 0:
        break
    
    for i in range(1,N):
        n,d = map(int,input().split())
        w[i] = w[n]+wx[d]
        h[i] = h[n]+hy[d]
        
    print(max(w)-min(w)+1,max(h)-min(h)+1)


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

vector<ll> divisor(ll N) {
    vector<ll> res;
    for (ll i = 1L; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            ll j = N / i;
            if (j != i) {
                res.push_back(j);
            }
        }
    }
    sort(res.begin(), res.end());
    return res;
}


void Main() {
    ll N;
    cin >> N;
    auto X = divisor(N);
    ll ans = INF;
    for (auto x: X) {
        ll y = N / x;
        ans = min(ans, x - 1 + y - 1);
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
using VVI = vector<vector<long long int> >;


int main(void) {
    Int a, b, c;
    cin >> a >> b >> c;
    cout << c << " " << a << " " << b << endl;
    return 0;
}


Measured memory_bytes: 3624
/*
author : seryu
title : contest
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(all(x), val), x.end())
typedef long long ll;
typedef pair<int, int> P;
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; }
ll MOD = 1000000007;
int INF = 1001001001;

void solve()
{
	ll x;
	cin >> x;
	ll now = 100;
	int ans = 0;
	while (true)
	{
		ans++;
		ll next = ll(double(now)*1.01);
		if(next >= x)
		{
			cout << ans << endl;
			return;
		}
		now = next;
	}
	
	return;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 3652
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    l=list(map(int,input().split()))
    if l.count(1) and l.count(9) and l.count(7) and l.count(4):
        print('YES')
    else:
        print('NO')
    
resolve()

Measured memory_bytes: 38384
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int ki=0;
    int gu=0;
    for(int i=0;i<n;i++){
      if((sc.nextInt()&1)==1){
        ki++;
      }else{
        gu++;
      }
    }
    if((ki&1)==0){
      System.out.println("YES");
    }else if(ki+gu==1){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  }
}

Measured memory_bytes: 48376