akhauriyash/Code-Regression huggingface dataset:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
from fractions import gcd

import copy
class SegmentTree:
    def __init__(self, N, func, I):
        self.sz = N
        self.func = func
        self.I = copy.deepcopy(I)
        self.seg = [copy.deepcopy(I) for i in range(self.sz * 2)]
 
    def assign(self, k, x):
        self.seg[k + self.sz] = copy.deepcopy(x)
 
    def build(self):
        for i in range(self.sz - 1, 0, -1):
            self.seg[i] = self.func(self.seg[2 * i], self.seg[2 * i + 1])
 
    def update(self, k, x):
        k += self.sz
        self.seg[k] = copy.deepcopy(x)
        while k > 1:
            k >>= 1
            self.seg[k] = self.func(self.seg[2 * k], self.seg[2 * k + 1])
 
    def query(self, a, b):
        L = copy.deepcopy(self.I)
        R = copy.deepcopy(self.I)
        a += self.sz
        b += self.sz
        while a < b:
            if a & 1:
                L = self.func(L, self.seg[a])
                a += 1
            if b & 1:
                b -= 1
                R = self.func(self.seg[b], R)
            a >>= 1
            b >>= 1
        return self.func(L, R)

N = int(readline())
m = map(int,read().split())
seg = SegmentTree(N , gcd , 0)
for i in range(N):
    seg.assign(i , next(m))
seg.build()
ans = 1
for i in range(N):
    ans = max(ans,gcd(seg.query(0,i) , seg.query(i+1,N)))
print(ans)

Measured memory_bytes: 107424
import math
from functools import lru_cache

@lru_cache(maxsize=None)
def gcd(x, y):
    return math.gcd(x, y)


k = int(input())
answer = 0
ary = []
for a in range(1, k + 1):
    for b in range(1, k + 1):
        if a >= b:
            ary.append(gcd(b, a))
        else:
            ary.append(gcd(a, b))

h = {}
for a in ary:
    if a not in h:
        h[a] = 0
    h[a] += 1
# print(h)

for x in h.keys():
    for c in range(1, k + 1):
        answer += gcd(x, c) * h[x]
print(answer)


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


public class Main{
    static long [][] memo;
    static long [] pow = new long[33];
    static ArrayList <Integer> [] graph;
    static Integer [] d;
    static int [] dist;
    static boolean[][] visited;
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        // Start writing your solution here. -------------------------------------
        long MOD = 1000000007;
        //int t = sc.nextInt();
        int t = 1;
        while(t -- > 0)
        {
            HashSet<String> set = new HashSet();
            int n = sc.nextInt();
            for(int i = 0; i < n; i++)
                set.add(sc.next());
            out.println(set.size());
        }
        out.close();
    }
    public static void bfs(int source, int i, int g)
    {
        if(visited[i][g]) return;
        visited[i][g] = true;
        if(g == 0) graph[source].add(i);

        if(dist[i] <= g) bfs(source, i - 1, g - dist[i]);
        if(dist[i + 1] <= g) bfs(source, i + 1, g - dist[i + 1]);
    }
    public static long solve(long n){
        for(int i = 1; i < 33; i ++)
            if(n % pow[i] == 0)
                return n / pow[i];
        return -1;
    }
    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;
    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

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


Measured memory_bytes: 72228
#include <numeric>
#include<iostream>
#include<set>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
using namespace std;
#define int long long
#define inf 1000000007
#define rep(i,j,n) for(int i=j;i<n;i++)
typedef pair<int,int>  P;
struct edge{int to,cost;};
double pi = 3.141592653589793;
//使うやつはここから下に置こうな
signed main(){
    int n;cin>>n;
    int a[114514];
    rep(i,0,n){
        cin>>a[i];
    }
    sort(a,a+n);
    int  ans=a[0];
    double key=a[n-1];
    key/=2;
    rep(i,0,n-1){
        if(abs(a[i]-key)<abs(ans-key)){
            ans=a[i];
        }
    }cout<<a[n-1]<<" "<<ans<<endl;
    return 0;
}

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

int main(){
  int a=1;
  for(int i=0;i<5;i++){
    int v;
    cin >> v;
    if(v==0){
      cout<< a;
      break;
    }
    else{
      a++;
    }
  }
  return 0;
}

Measured memory_bytes: 3544
(defun solve (n s)
  (let ((w (make-array n))
        (b (make-array n)))
    (setf (aref w 0) (if (eq #\. (char s 0)) 1 0))
    (setf (aref b (1- n)) (if (eq #\# (char s (1- n))) 1 0))
    (loop for i from 1 below n
          do (setf (aref w i) (+ (aref w (1- i)) (if (eq #\. (char s i)) 1 0))))
    (loop for i from (- n 2) downto 0
          do (setf (aref b i) (+ (aref b (1+ i)) (if (eq #\# (char s i)) 1 0))))
    (- n (loop for i below n maximize (+ (aref w i) (aref b i))))))
(format t "~A~%" (solve (read) (read-line)))

Measured memory_bytes: 22372
using System;
using static System.Console;
using static System.Math;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace atcoder
{
    class Program
    {
        //メイン関数
        static void Main(string[] args)
        {
            WriteLine(PlusOneSigma(1, scanInt()));
        }

        #region 細々としたツール(関数)

        #region 標準入力
        //変数の入力
        static string scan() => ReadLine();
        static int scanInt() => int.Parse(ReadLine());

        //配列の入力
        static string[] MultiScan(char Split)
        {
            string[] N = ReadLine().Split(Split);
            return N;
        }
        static string[] MultiScan()
        {
            string[] N = ReadLine().Split(' ');
            return N;
        }

        static List<int> MultiScanInt(char Split)
        {
            string[] N = ReadLine().Split(Split);
            List<int> output = new List<int>();

            for (int i = 0; i < N.Length; i++)
            {
                output.Add(int.Parse(N[i]));
            }

            return output;
        }
        static List<int> MultiScanInt(char Split, int roop)
        { 
            string[] N = ReadLine().Split(Split);
            List<int> output = new List<int>();

            for (int i = 0; i < roop; i++)
            {
                output.Add(int.Parse(N[i]));
            }

            return output;
        }
        #endregion

        #region 数学関連
        public static int Gcd(int a, int b)
        {
            if (a < b)
                // 引数を入替えて自分を呼び出す
                return Gcd(b, a);
            while (b != 0)
            {
                var remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;
        }//最大公約数
        public static int Lcm(int a, int b)
        {
            return a * b / Gcd(a, b);
        }//最小公倍数
        public static int PlusOneSigma(int x, int loop)
        {
            int output = 0;
            for (int i = 0; i < loop; i++)
            {
                output = output + x + i;
            }
            return output;
        }//１づつ加算のシグマ
        #endregion

        #endregion
    }
}


Measured memory_bytes: 13140
package main

import "fmt"

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

	for i := 0; i < 2; i++ {
		if a > b {
			a, b = b, a
		}

		if b > c {
			b, c = c, b
		}
	}

	fmt.Println(a, b, c)
}



Measured memory_bytes: 1108
#include <bits/stdc++.h>
#define N 1000005
#define ll long long int 	
#define MP make_pair
#define pb push_back
#define ppb pop_back
#define sp " "
#define endl "\n"
#define fi first
#define se second
#define ii pair<int,int>
#define lli pair<ll,ll>
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define fast2 freopen ("myfile.in","r",stdin);freopen ("myfile.out","w",stdout);
#define mod 1000000007
#define fs(x,y) for(int i=1;i<=y;i++) cin>>x[i]
#define fo(i,x,y) for(int i=x;i<=y;i++)
using namespace std;

ll n,m,ar[N],sum;

char s[N],ans[N];



int main()
{
	fast;
	cin>>n>>s+1>>m;
	fo(i,1,n)
	if(s[i]!=s[m])
		ans[i]='*';
	else
		ans[i]=s[i];
	cout<<ans+1;

}

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

int main()
{
ll n ;
cin >> n ;
vector<ll> a(n);
rep(i, n){
  cin >> a[i];
}
if(n%2==0){
ll sum=0;
rep(i,n){
  if(i%2)sum+=a[i];
}
ans=sum;
rep(i,n/2){
  sum+=a[i*2]-a[i*2+1];
  ans=max(ans,sum);
}
}
else{
vector<vector<ll>> v(n+1, vector<ll>(3,0) );
rep(i,n){
  if(i%2){
    v[i+1][0]=v[i][0];
    v[i+1][1]=max(v[i][0],v[i][1]+a[i]);
    v[i+1][2]=v[i][2];
  }
  else{
    v[i+1][0]=v[i][0]+a[i];
    v[i+1][1]=v[i][1];
    v[i+1][2]=max(v[i][1],v[i][2]+a[i]);
  }
}
ans=max({v[n][0],v[n][1],v[n][2]});
}
cout << ans << endl;
return 0;
}

Measured memory_bytes: 15572
use std::io;


fn main() {
    let s = read_one::<String>();
    let key = "keyence".to_string();
    for i in 0..s.len() { for j in i..s.len() {
        let f = &s[0..i];
        let e = &s[j..s.len()];
        if key == format!("{}{}", f, e) {
            println!("YES");
            return;
        }
    }}
    println!("NO");
}


#[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 <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll a, b, k;std::cin >> a >> b >> k;
  if(k<=a){
    std::cout << a-k << " " << b << '\n';
  }else{
    std::cout << 0 << " " << max((ll)0, a+b-k) << '\n';
  }
  return 0;
}


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

int main(){
    string S;
    cin >> S;

    int ans;
    if(S=="SUN")
        ans = 7;
    else if(S=="MON")
        ans = 6;
    else if(S=="TUE")
        ans = 5;
    else if(S=="WED")
        ans = 4;
    else if(S=="THU")
        ans = 3;
    else if(S=="FRI")
        ans = 2;
    else
        ans = 1;

    cout << ans << endl;

}


Measured memory_bytes: 256
ary = gets.chomp.split("")

odd = ary.each_slice(2).map(&:first)

if ary.length % 2 == 0 
    even = ary.each_slice(2).map(&:last)
else
    even = ary.each_slice(2).map(&:last)
    even.delete_at(-1)
end


if odd.include?("L") == false && even.include?("R") == false 
    puts "Yes"
else
    puts "No"
end

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

using namespace std;
using LL = long long;
using P = pair<int, int>;
using Monoidapris = tuple<int, int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

template <typename Monoid>
class SegmentTree{
    private:
        using Func = function<Monoid(Monoid, Monoid)>;
        int n; // 最下段の数
        vector<Monoid> segmentTree; // セグ木本体
        const Func f; // 二項演算
        const Monoid identityElement; // モノイドの単位元
    
    public:
        SegmentTree(vector<Monoid> vec, const Func f, const Monoid identityElement);
        void Update(int x, Monoid val);
        Monoid Query(int a, int b, int k = 0, int l = 0, int r = -1); // 使う時は区間[a, b)のみ指定すれば良い
};

template <typename Monoid>
SegmentTree<Monoid>::SegmentTree(vector<Monoid> vec, const Func f, const Monoid identityElement) :
    f(f), identityElement(identityElement)
    {
        int sz = vec.size();
        n = 1;
        while(n < sz) n *= 2;
        segmentTree.assign(2*n-1, identityElement);
        for(int i = 0; i < sz; i++) segmentTree[i+n-1] = vec[i];
        for(int i = n-2; i >= 0; i--) segmentTree[i] = f(segmentTree[2*i+1], segmentTree[2*i+2]);
    }

template <typename Monoid>
void SegmentTree<Monoid>::Update(int x, Monoid val){
    x += n - 1;
    segmentTree[x] = val;
    while(x > 0){
        x = (x - 1) / 2;
        segmentTree[x] = f(segmentTree[2*x+1], segmentTree[2*x+2]);
    }
}

template <typename Monoid>
Monoid SegmentTree<Monoid>::Query(int a, int b, int k, int l, int r){
    if(r < 0) r = n;

    if(r <= a || b <= l) return identityElement;

    if(a <= l && r <= b) return segmentTree[k];

    int vl = Query(a, b, 2*k+1, l, (l+r)/2);
    int vr = Query(a, b, 2*k+2, (l+r)/2, r);
    return f(vl, vr);
}

/*************** using variables ***************/
int n, q;
/**********************************************/

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> n >> q;
    const int _INT_MAX = pow(2, 31) - 1;
    vector<int> a(n, _INT_MAX);
    SegmentTree<int> st(a, [](int a, int b){return min(a, b);}, _INT_MAX);
    REP(i, q){
        int com, x, y;
        cin >> com >> x >> y;
        if(com == 0) st.Update(x, y);
        else cout << st.Query(x, y+1) << endl;
    }
}



Measured memory_bytes: 4636
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

int main(){

    cout<<setprecision(16);


    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        int k=i*1.08;
        if(k==n){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<":("<<endl;




return 0;
}


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

int main(){
    long long N, L;
    cin >> N >> L;
    
    vector<string> S(N);
    for(int i = 0; i < N; ++i)cin >> S[i];
    
    sort(S.begin(), S.end());
    
    for(auto s : S)cout << s;
    cout << endl;
}

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

int main() {
  int n;
  while(cin >> n && n) {
    vector<int> a;
    a.push_back(0);
    double h=0;
    for(int i=0; i<n; i++) {
      int x;
      cin >> x;
      h+=x;
      for(int i=a.size()-1; i>=0; i--) a.push_back(a[i]+x);
    }
    h/=2;
    double max=1000000000;
    for(int i=0; i<a.size(); i++) {
      if(max>abs(h-(double)a[i])) max=abs(h-a[i]);
    }
    int ans=max*2;
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 9184
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };


struct MyStruct
{
	int parent = -1;
	int right = -1;
	int left = -1;
	int depth = 0;
	int height = 0;
	int sibling = -1;
	int degree = 0;
};

int n;
vector<MyStruct>list(100);

int func(int index, int cnt) {

	list[index].depth = cnt;
	if (list[index].left != -1) { func(list[index].left, cnt + 1); }
	if (list[index].right != -1) { func(list[index].right, cnt + 1); }

	return 0;
}


int main() {
	int i, j;
	


	cin >> n;


	for (i = 0; i < n; i++) {
		int num1, num2, num3;
		cin >> num1 >> num2 >> num3;

		list[num1].left = num2;
		list[num1].right = num3;

		if (num2 != -1) {
			list[num2].parent = num1;
			list[num2].sibling = num3;
		}

		if (num3 != -1) {
			list[num3].parent = num1;
			list[num3].sibling = num2;
		}

		
		
	}


	for (i = 0; i < n; i++) {
		if (list[i].right == -1 && list[i].left == -1) {
			list[i].height = 0;
		}
	}
	
	for (i = 0; i < n; i++) {
		if (list[i].left == -1 && list[i].right == -1) {
			int num = list[i].parent;
			int cnt = 0;

			do{
				if (num == -1) break;
				cnt++;
				list[num].height = max(cnt, list[num].height);
				num = list[num].parent;
//				if (num == -1) break;
			} while (num != -1);
			
		}
	}

	int parent;

	for (i = 0; i < n; i++) {
		if (list[i].parent == -1) {
			parent = i;
			break;
		}
	}
	
	func(parent, 0);

	for (i = 0; i < n; i++) {
		if (list[i].left != -1 && list[i].right != -1) {
			list[i].degree = 2;
		}
		else if (list[i].left != -1 || list[i].right != -1) {
			list[i].degree = 1;
		}
	}
	
	for (i = 0; i < n; i++) {
		cout << "node " << i << ": parent = " << list[i].parent << ", sibling = " << list[i].sibling << ", degree = " << list[i].degree << ", depth = " << list[i].depth << ", height = " << list[i].height << ", ";

		if (list[i].parent == -1) {
			cout << "root" << endl;
		}
		else if (list[i].left != -1 || list[i].right != -1) {
			cout << "internal node" << endl;
		}
		else if (list[i].left == -1 || list[i].right == -1) {
			cout << "leaf" << endl;
		}
	}

	
	
	
	
	
	getchar();
	getchar();
	return 0;
}




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

#include <iostream>

using namespace std;

int main() {
  string a, b;
  cin >> a >> b;
  int x, y;
  cin >> x >> y;
  string input;
  cin >> input;
  if (input == a) {
    x--;
  } else if (input == b) {
    y--;
  }
  cout << x << " " << y << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include <numeric>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;

using namespace std;
const int MOD=1000000007;
//scanf("%d", &a); '\n';


ll gcd(ll a, ll b)
{
	if (a < b) {
		a ^= b;
		b ^= a;
		a ^= b;
	}

	return b ? gcd(b, a % b) : a;
}

ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
int main() {
	ll n,m;
	cin >> n>>m;
	cout << lcm(n, m);
	}

	

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, long> P;
typedef struct edge{ long cost; int to; }edge;

const long INF = 1e11;

int main(){
  int n; cin >> n;
  long d[n];
  vector<edge> G[n];
  for(int i=0; i<n; i++){
    d[i] = INF;
    int u, k; cin >> u >> k;
    int v, c;
    for(int j=0; j<k; j++){
      cin >> v >> c;
      edge e; e.to = v; e.cost = c;
      G[u].push_back(e);
    }
  }
  priority_queue<P, vector<P>, greater<P>> que;
  d[0] = 0;
  que.push(P(0, 0));
  while(!que.empty()){
    P v = que.top(); que.pop();
    if(d[v.second] < v.first) continue;
    for(int i=0; i<G[v.second].size(); i++){
      edge e = G[v.second][i];
      if(d[e.to] > d[v.second] + e.cost){
        d[e.to] = d[v.second] + e.cost;
        que.push(P(d[e.to], e.to));
      }
    }
  }
  for(int i=0; i<n; i++){
    cout << i << " " << d[i] << endl;
  }
}


Measured memory_bytes: 11836
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int gcd(int a, int b){
    if(a < b) swap(a, b);
    while(b != 0){
        int t = a;
        a = b;
        b = t%b;
    }
    return a;
}

int main(){
    int N, K; cin >> N >> K;
    int maxv = 0;
    vector<int> a(N);
    for(int i=0; i<N; i++){
        cin >> a[i];
        maxv = max(maxv, a[i]);
    }

    if(K > maxv){
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }
    
    int ch = a[0];
    for(int i=1; i<N; i++) ch = gcd(ch, a[i]);

    if(K%ch == 0) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 640
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>

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

int main()
{
	string S;
	cin>>S;
	for(int i=0;i<S.length()-1;i++)
	{
		if(S[i]==S[i+1])
		{
			cout<<"Bad"<<endl;
			return 0;
		}
	}
	cout<<"Good"<<endl;
	return 0;
}

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

string s = "";
vector<long long> ss;

long long toi(string s) {
    long long res = 0;
    for (auto &c : s) res = res * 10 + c - '0';
    return res;
}

void gen(int n, char d) {
    if (n == 0) { 
        ss.push_back(toi(s));
        return;
    }

    for (char id = max((int)'0', d - 1); id <= min((int)'9', d + 1); id++) {
        s.push_back(id);
        gen(n - 1, id);
        s.pop_back();
    }
}

int main () {
    for (int i = 1; i <= 10; i++)
        for (int d = '1'; d <= '9'; d++) {
            s.push_back(d);
            gen(i - 1, d);
            s.pop_back();
        }
    sort(ss.begin(), ss.end());
    int k;
    cin >> k;
    cout << ss[k - 1] << "\n";
}



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

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


void count(vector<unsigned long long int>&a) {
	rep(i, a.size()) {
		if (i == 0)
			a[i] = 0;
		else
			a[i] = i - 1 + a[i - 1];
	}
}

int main() {

	vector<unsigned long long int>b(100001);
	count(b);

	int n;
	cin >> n;
	vector<string>s(n);

	rep(i, n)
		cin >> s[i];


	map<string, unsigned long long int>dic;
	rep(i, n) {
		sort(s[i].begin(), s[i].end());
		dic[s[i]]++;
	}

	unsigned long long int ans = 0;
	map<string, unsigned long long int>::iterator it;
	for (it = dic.begin(); it != dic.end(); it++)
		ans += b[it->second];

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 18944
using DataStructures
const double = Float64
const int = Int64

parseint(x) = parse(int, x)
readint() = map(parseint, split(readline()))

function main()
  N = readint()[1]
  d = Dict{String,int}()
  
  for _ in 1:N
    s = readline()
    s = join(sort(split(s,"")))
    get!(d,s,0)
    d[s]+=1
  end

  s = 0
  for v in values(d)
    s += v*(v-1)÷2
  end
  println(s)
end



main()

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

int main(){
	string s; cin >> s;
	if (s[0] == s[1] || s[1] == s[2] || s[0] == s[2]) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    int n,ans = INF;
    cin >> n;
    repi(i, n, 0)
    {
        int a, s = 0;
        cin >> a;
        while (a % 2 == 0)
        {
            s++;
            a /= 2;
        }
        ans = min(ans, s);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define INF (1<<28)

int n;
int g[101][101];

int mst() {
  int i, res, mini, id;
  int cost[101], vis[101];
  for(i = 0; i < 101; ++i) {
    cost[i] = INF;
    vis[i] = 0;
  }
  cost[0] = 0;
  res = 0;
  while(1) {
    mini = INF;
    id = -1;
    for(i = 0; i < n; ++i) {
      if(vis[i]) continue;
      if(cost[i] < mini) {
        mini = cost[i];
        id = i;
      }
    }
    if(id == -1) break;
    vis[id] = 1;
    res += cost[id];
    for(i = 0; i < n; ++i) {
      if(vis[i]) continue;
      if(g[id][i] < cost[i]) {
        cost[i] = g[id][i];
      }
    }
  }
  return res;
}

int main() {
  int i, j;
  scanf("%d", &n);
  for(i = 0; i < n; ++i) {
    for(j = 0; j < n; ++j) {
      scanf("%d", &g[i][j]);
      if(g[i][j] == -1) g[i][j] = INF;
    }
  }
  printf("%d\n", mst());
  return 0;
}

Measured memory_bytes: 0
import sys                                                                     
N = int(sys.stdin.readline())                                                  
Cs = []                                                                        
Ss = []                                                                        
Fs = []                                                                        
for i in range(N - 1):                                                         
    C, S, F = map(int, sys.stdin.readline().split())                           
    Cs.append(C)                                                               
    Ss.append(S)                                                               
    Fs.append(F)                                                               
Cs.append(0)                                                                   
Ss.append(0)                                                                   
Fs.append(1)                                                                   
                                                                               
for i in range(N - 1):                                                         
    t = 0                                                                      
    for j in range(i, N - 1):                                                  
        t = max(t, Ss[j]) + Cs[j]                                              
        t = ((t - 1) // Fs[j + 1] + 1) * Fs[j + 1]                             
    print(t)                                                                   
print(0)

Measured memory_bytes: 3188
#include <stdio.h>
 
int main(void){
	
  int a,s,i;
  
  s = 0;
  
  scanf("%d",&a);
  
  for(i = 1; i <= a; i++){
  s = s + i;
  }
  
  printf("%d\n",s);
  return 0;
}

Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


vector<int> sum[300 * 300];

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

	map<int, pair<int, int>> pos;
	int H , W , D;
	cin >> H >> W >> D;
	rep(i,H)rep(j,W) {
		int a;
		cin >> a;
		pos[a - 1] = make_pair(i, j);
	}

	/*rep(i,H*W) {
		sum[i].push_back(0);
	}*/
	rep(i,H*W) {
		int m = i%D;
		int d = 0;
		if (i >= D) {
			auto p = pos[i - D];
			auto q = pos[i];
			d = abs(p.first - q.first) + abs(p.second - q.second);
			d += sum[m].back();
		}
		sum[m].push_back(d);
	}
	int Q;
	cin >> Q;
	rep(i,Q) {
		int L,R;
		cin >> L >> R;
		L--; R--;
		int m = L % D;
		cout << sum[m][R / D] - sum[m][L / D] << endl;
	}



	return 0;
}

Measured memory_bytes: 11008
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
ulong bignum = 1_000_000_007;
alias Pair = Tuple!(long, "number", long, "times");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    auto n = lread();
    auto a = aryread();
    auto b = aryread();
    auto c = aryread();
    a.sort();
    b.sort();
    c.sort();
    auto third_cand = new long[](n + 1);
    ulong bbounds, cbounds, alter;
    foreach (i, e; b)
    {
        while (cbounds < n && e >= c[cbounds])
            cbounds++;
        third_cand[i + 1] = third_cand[i] + (n -cbounds);
    }
    foreach (e; a)
    {
        while (bbounds < n && e >= b[bbounds])
            bbounds++;

        if(bbounds >= n)
            break;

        alter += third_cand[$ - 1] - third_cand[bbounds];
    }
    alter.writeln();
}

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

int bsearch(ll k, vector<ll> &b) {
  int l = 0, r = b.size() - 1;
  while (l < r) {
    int mid = (l + r) / 2;
    if (b[mid] > k) r = mid - 1;
    else if (b[mid] <= k && b[mid + 1] > k) return mid + 1;
    else l = mid + 1;
  }
  if (l == 0 && b[l] > k) return 0;
  else if (l == 0 && b[l] <= k) return 1;
  else if (l > 0 && b[l] > k) return -1;
  else return l + 1;
}

int main() {
  int n, m; ll k;
  cin >> n >> m >> k;
  vector<ll> acum(n), bcum(m);
  rep(i, n) {
    ll a;
    cin >> a;
    acum[i] = a + (i > 0 ? acum[i - 1] : 0);
  }
  rep(i, m) {
    ll b;
    cin >> b;
    bcum[i] = b + (i > 0 ? bcum[i - 1] : 0);
  }

  int ans = bsearch(k, bcum);
  rep(i, n) {
    if (acum[i] <= k) {
      ll kk = k - acum[i];
      ans = max( i + 1 + bsearch(kk, bcum), ans );
    }
  }

  cout << ans << endl;

  return 0;
}

/*
*/


Measured memory_bytes: 6428
import java.io.*;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
		int[] inputs = Arrays.stream(stdin.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
		int[] fee = Arrays.stream(stdin.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
		long left = Arrays.stream(fee).filter(i -> i < inputs[2]).count();
		long right = Arrays.stream(fee).filter(i -> i > inputs[2]).count();
		System.out.println(Math.min(left, right));
	}

}

Measured memory_bytes: 26708
using Printf
function main()
    n = parse(Int, readline())
    ans = 0
    a = zeros(Int, n)
    for i in 1:n
        for j in i:i:n
            a[j] += 1
        end
    end

    for i in 1:n
        ans += i*a[i]
    end
    println(ans)
end

main()

Measured memory_bytes: 236792
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include<stack>
#include<tuple>
using namespace std;
#define INF 1100000000000
#define MAX 100000
#define MOD 100000
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> p;
typedef pair< pair<int,int>, int> p; 
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)

ll dp[110][110000];

int main(){
    int N; ll W;
    cin>>N>>W;
    for(int i=0;i<110;i++){
        for(int j=0;j<110000;j++) dp[i][j]=INF;
    }
    dp[0][0]=0;
    for(int i=0;i<N;i++){
        ll w; int v;
        cin>>w>>v;
        for(int j=0;j<110000;j++){
            if(dp[i][j]==INF) continue;
            dp[i+1][j+v]=min(dp[i+1][j+v],dp[i][j]+w);
            dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
        }
    }
    int ans=0;
    for(int i=0;i<110000;i++){
        if(dp[N][i]<=W) ans=i;
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 94720
def count_digits(N):
        N_temp = N
        digits = 0
        while N_temp != 0:
                digits += 1
                N_temp = int(N_temp/10)
        
        return digits

N = int(input())
ans = 0
for i in range(1,N+1):
        x = count_digits(i)
        if x%2 == 1:
                ans += 1
        else:
                pass

print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
typedef pair<double,double> point;
const ll MAX = 200000;
constexpr ll nx[8] = {1,0,-1,0,1,-1,1,-1};
constexpr ll ny[8] = {0,1,0,-1,1,1,-1,-1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> a(n),b(n);
    rep(i,n){
        cin >> a[i] >> b[i];
    }
    SORT(a);
    SORT(b);
    if (n%2){
        PRINT(b[n/2]-a[n/2]+1);
    }
    else{
        double s = (a[n/2-1]+a[n/2])/2.0,t = (b[n/2-1]+b[n/2])/2.0;
        ll ans = (t-s)/0.5+1;
        PRINT(ans);
    }
}


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

int main()
{
  static const int N = 100000;
  static const int M = 100000007;
  static int dp1[N+1], dp2[N+1];
  dp1[1] = 1;
  dp1[2] = 2;
  dp1[3] = 4;
  dp1[4] = 8;
  dp1[5] = 16;
  for (int i = 6; i <= N; i++) {
    dp1[i] = 1;
    for (int j = 1; j <= 5; j++) {
      dp1[i] = (dp1[i] + dp1[i-j]) % M;
    }
  }
  dp2[1] = 1;
  dp2[2] = 2;
  dp2[3] = 4;
  for (int i = 4; i <= N; i++) {
    dp2[i] = 1;
    for (int j = 1; j <= 3; j++) {
      dp2[i] = (dp2[i] + dp2[i-j]) % M;
    }
  }
  string s;
  while (cin >> s && s != "#") {
    const int l = s.size();
    long long ans = 1LL;
    for (int i = 0; i < l; i++) {
      int k = i;
      while (k < l && s[k] == s[i]) {
        ++k;
      }
      if (s[i] == '8' || s[i] == '0') {
        ans = (ans * dp2[k - i]) % M;
      } else {
        ans = (ans * dp1[k - i]) % M;
      }
      --k;
      i = k;
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1924
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import Counter

S = input()

P = 2019
N = len(S)

def solve_2(S):
    ind = (i for i, x in enumerate(S, 1) if x % 2 == 0)
    return sum(ind)

def solve_5(S):
    ind = (i for i, x in enumerate(S, 1) if x % 5 == 0)
    return sum(ind)

def solve(S,P):
    if P == 2:
        return solve_2(S)
    if P == 5:
        return solve_5(S)
    S = S[::-1]
    T = [0] * len(S)
    T[0] = int(S[0]) % P
    power = 1
    for i in range(1, len(S)):
        power *= 10
        power %= P
        T[i] = T[i-1] + power * int(S[i])
        T[i] %= P
    counter = Counter(T)
    return sum(x * (x - 1) // 2 for x in counter.values()) + counter[0]


print(solve(S,P))

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

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

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

const int MAX_NM = 1e5 + 10;
int N, M;
vector<vector<int>> G;
int dp[MAX_NM];

int rec(int v)
{
	if (dp[v] != -1)
	{
		return dp[v];
	}

	int res = 0;
	for (auto nv : G[v])
	{
		chmax(res, rec(nv) + 1);
	}
	return dp[v] = res;
}

int main()
{
	cin >> N >> M;
	G.assign(N, vector<int>());
	for (int i = 0; i < M; ++i)
	{
		int x, y;
		cin >> x >> y;
		--x, --y;
		G[x].push_back(y);
	}

	for (int i = 0; i < MAX_NM; ++i)
	{
		dp[i] = -1;
	}

	int res = 0;
	for (int v = 0; v < N; ++v)
	{
		chmax(res, rec(v));
	}

	cout << res << endl;
}

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

int main() {
  int n, ans, max; ans = 1;
  cin >> n;
  vector<int> h(n);

  rep(i, n) {
    cin >> h[i];
  }

  max = h[0];
  rep(i, n-1) {
    if (h[i+1] >= max) {
      max = h[i+1];
      ans++;
    }
  } 

  cout << ans << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	string t;
	for (int i = 0; i < s.length(); i++)
	{
		char a = s[i] + n;
		if (a > 'Z')
		{
			a -= 26;
		}
		t += a;
	}

	println(t);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long int n,w;
  cin>>n>>w;
  vector<long int> weight(n+1);
  vector<long int> value(n+1);
  for(long int i=1;i<=n;i++){
    cin>>weight[i]>>value[i];
  }
  vector<vector<long int>> dp(n+1,vector<long int>(w+1));
  for(long int i=1;i<=n;i++){
    for(long int j=1;j<=w;j++){
      if(j>=weight[i]) dp[i][j]=max(dp[i-1][j],dp[i-1][j-weight[i]]+value[i]);
      else dp[i][j]=dp[i-1][j];
    }
  }
  cout<<dp[n][w];
  return 0;
}

Measured memory_bytes: 80256
#include <iostream>
#include<string>
#include<stdio.h>
using namespace std;

int main()
{
	int n, t;
	cin >> n >> t;
	int num[200000];
	for (int i = 0; i < n; i++)
	{
		cin >> num[i];
	}
	int max = 0, goukei = 0;
	for (int i=1; i < n;i ++)
	{
		if (num[i] - max > t) {
			goukei += num[i] - max - t;
		}
		max = num[i];
	}
	cout << max + t - goukei;
	return 0;
}


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

int main(){
    int n,y;
    cin >> n >> y;
    for(int i = 0; i <= n;i++){
        for(int j = 0; j <= n - i; j++){
            int k = n - i - j;
            if(1000 * i + 5000 * j + 10000 * k == y){
                cout << k << ' ' << j << ' ' << i << ' ' << endl;
                return 0;
            }
        }
    }
    cout << -1 << ' ' << -1 << ' ' << -1 << ' ' << endl;
    return 0;
}

Measured memory_bytes: 256
N,u,v = map(int,input().split())
u -=1
v -=1
AB = [list(map(int,input().split())) for _ in [0]*(N-1)]

E = [[] for _ in [0]*N]
for a,b in AB:
    E[a-1].append(b-1)
    E[b-1].append(a-1)

def dist_bfs(N,E,start):
    d = [-1]*N
    d[start] = 0
    q = [start]
    while q:
        qq = []
        for i in q:
            di = d[i]
            for j in E[i]:
                if d[j]!=-1:continue
                d[j] = di+1
                q.append(j)
        q = qq
    return d

d = dist_bfs(N,E,v)

dt = d[u] - (d[u]-1)//2

w = u
dw = d[w]
while dw != dt:
    for j in E[w]:
        if d[j] == (dw-1):
            w = j
            break
    dw = d[w]
t = w

ans = d[u]-dt

tmp = 0
q = [t]
while q:
    i = q.pop()
    di = d[i]
    tmp = max(tmp,di-dt)
    for j in E[i]:
        if d[j] >di:
            q.append(j)

ans += tmp
ans += 1-d[u]%2

print(ans)

Measured memory_bytes: 83928
import math

def main():
    A,B = map(int, input().split())

    ans = -1

    for i in range(1, 1251):
        at = math.floor(i * 0.08)
        bt = math.floor(i * 0.1)
        if at == A and bt == B:
            ans = i
            break
    
    print(ans)

main()

Measured memory_bytes: 38512
# Aizu Problem 00173: Haunted House
#
import sys, math, os, bisect

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


for line in sys.stdin:
    a, b, c = line.split()
    b, c = int(b), int(c)
    t = b + c
    p = 200 * b + 300 * c
    print(a, t, p)

Measured memory_bytes: 7748
#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
using namespace std;

int main(){
	
	int n;
	cin >> n;
	vector<long long> a(n,0),b(n-1,0);
	
	for(int i=0;i<n-1;i++){
		cin >> b[i];
	}
	
	for(int i=0;i<n;i++){
		if(i==0){
			a[i]=b[0];
		}else if(i<n-1){
			a[i]=min(b[i-1],b[i]);
		}else if(i==n-1){
			a[i]=b[i-1];
		}
	}
	
	long long sum=0;
	for(int i=0;i<n;i++){
		sum+=a[i];
	}
	cout << sum << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define Yes(condition) if(condition){ cout << "Yes" << '\n'; }else{ cout << "No" << '\n'; }
#define YES(condition) if(condition){ cout << "YES" << '\n'; }else{ cout << "NO" << '\n'; }
#define yes(condition) if(condition){ cout << "yes" << '\n'; }else{ cout << "no" << '\n'; }




int main() {
    ll n, k;
    cin >> n >> k;
    
    ll m;
    bool ok = false;
    for(ll i = 0; i < n - 2 && !ok; i++){
        for(m = i * 7; m <= i * 7 + 5; m++){
            if((9 * m + 72) % 11 == k){
                ok = true;
                break;
            }
        }
    }
    if(!ok){
        cout << 0 << endl;
        return 0;
    }
    
    ll res = ((n - 2) * 7 - 2 - m) / 11 + 1;
    vector<bool> ok2(7);
    REP(i, 7){
        ok2[i] = (49 + m - i * 3) % 7 != 0 && (49 + m - i * 3) % 7 != 6;
    }
    vector<ll> c(7);
    REP(i, 7){
        c[i] = res / 7;
    }
    REP(i, res % 7){
        c[i]++;
    }
    ll ans = 0;
    REP(i, 7){
        if(ok2[i]) ans += c[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second
int main(){
    ll n,ans=0,z=pow(10,9)+7;
    cin >> n;
    if(n==3){
        cout << 61 << endl;
        return 0;
    }
    ll dp[n+1][4][4][4][4];
    //A C G T
    //0 1 2 3

    for(ll i=0;i < 4;i++)
    {
        for(ll j=0;j < 4;j++)
        {
            for(ll k=0;k < 4;k++)
            {
                for(ll l=0;l < 4;l++)
                {
                    if(l==1 && k==2 && j==0){                       
                        dp[4][i][j][k][l]=0;
                    }
                    else if(l==1 && j==2 && k==0){
                        dp[4][i][j][k][l]=0;
                    }
                    else if(l==1 && j==2 && i==0){
                        dp[4][i][j][k][l]=0;
                    }
                    else if(l==1 && k==2 && i==0){
                        dp[4][i][j][k][l]=0;
                    }
                    else if(l==2 && k==1 && j==0){
                        dp[4][i][j][k][l]=0;
                    }
                    else if(i==0 && j==2 && k==1){
                        dp[4][i][j][k][l]=0;
                    }
                    else if(i==2 && j==0 && k==1){
                        dp[4][i][j][k][l]=0;
                    }
                    else if(i==0 && j==1 && k==2){
                        dp[4][i][j][k][l]=0;
                    }else{
                        dp[4][i][j][k][l] = 1;
                    }
                }
            }
        }
    }//ini

    for(ll h=5;h < n+1;h++)
    {
        for(ll i=0;i < 4;i++)
        {
            for(ll j=0;j < 4;j++)
            {
                for(ll k=0;k < 4;k++)
                {
                    for(ll l=0;l < 4;l++)
                    {
                    if(l==1 && k==2 && j==0){                       
                        dp[h][i][j][k][l]=0;
                    }
                    else if(l==1 && j==2 && k==0){
                        dp[h][i][j][k][l]=0;
                    }
                    else if(l==1 && j==2 && i==0){
                        dp[h][i][j][k][l]=0;
                    }
                    else if(l==1 && k==2 && i==0){
                        dp[h][i][j][k][l]=0;
                    }
                    else if(l==2 && k==1 && j==0){
                        dp[h][i][j][k][l]=0;
                    }else{
                        dp[h][i][j][k][l] = dp[h-1][0][i][j][k]%z +dp[h-1][1][i][j][k]%z +dp[h-1][2][i][j][k]%z +dp[h-1][3][i][j][k]%z;
                        dp[h][i][j][k][l] %= z;
                    }
                    
                    }
                }
            }
        }
    }
    for(ll i=0;i < 4;i++){
            for(ll j=0;j < 4;j++)
            {
                for(ll k=0;k < 4;k++)
                {
                    for(ll l=0;l < 4;l++)
                    {
                        ans += dp[n][i][j][k][l];
                        ans %= z;
                    }
                }
            }
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
main(){
int w,h,x,y,r;
cin>>w>>h>>x>>y>>r;

if(x+r<=w&&x-r>=0&&y+r<=h&&y-r>=0)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
  return 0;
}



Measured memory_bytes: 3100