akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int i, j;
    int temp;
    int N;
    int A[100];
    int count = 0;
    
    scanf("%d", &N);
    
    for(i=0;i<N;i++){
        scanf("%d", &A[i]);
    }
    
    for(i=0;i<N-1;i++){
        for(j=N-1;j>i;j--){
            if(A[j-1]>A[j]){
                temp = A[j];
                A[j] = A[j-1];
                A[j-1] = temp;
                count ++;
            }
        }
    }
    
    for(i=0;i<N;i++){
        if(i>0) printf(" ");
        printf("%d", A[i]);
    }
    printf("\n%d\n", count);
    
    return 0;
}

Measured memory_bytes: 604
n, m = map(int,input().split())
nums = [list(map(int,input().split())) for _ in range(n)]
ans = 0

a = []
for i in range(n):
    a.append((nums[i][0] + nums[i][1] + nums[i][2]))

a.sort(reverse=True)
k = 0
for i in range(m):
    k +=  a[i]
ans = max(ans, k)

a = []
for i in range(n):
    a.append((nums[i][0] + nums[i][1] - nums[i][2]))

a.sort(reverse=True)
k = 0
for i in range(m):
    k +=  a[i]
ans = max(ans, k)

a = []
for i in range(n):
    a.append((nums[i][0] - nums[i][1] + nums[i][2]))

a.sort(reverse=True)
k = 0
for i in range(m):
    k +=  a[i]
ans = max(ans, k)

a = []
for i in range(n):
    a.append((nums[i][0] - nums[i][1] - nums[i][2]))

a.sort(reverse=True)
k = 0
for i in range(m):
    k +=  a[i]
ans = max(ans, k)

a = []
for i in range(n):
    a.append((-nums[i][0] + nums[i][1] + nums[i][2]))

a.sort(reverse=True)
k = 0
for i in range(m):
    k +=  a[i]
ans = max(ans, k)

a = []
for i in range(n):
    a.append((-nums[i][0] + nums[i][1] - nums[i][2]))

a.sort(reverse=True)
k = 0
for i in range(m):
    k +=  a[i]
ans = max(ans, k)

a = []
for i in range(n):
    a.append((nums[i][0] - nums[i][1] + nums[i][2]))

a.sort(reverse=True)
k = 0
for i in range(m):
    k +=  a[i]
ans = max(ans, k)

a = []
for i in range(n):
    a.append((-nums[i][0] - nums[i][1] - nums[i][2]))

a.sort(reverse=True)
k = 0
for i in range(m):
    k +=  a[i]
ans = max(ans, k)

print(ans)

Measured memory_bytes: 3296
#include <iostream>
#include <stdio.h>
#include<bits/stdc++.h>
#define ll long long
#define read freopen("input/test (4).txt","r",stdin)
#define write freopen("output/test (4).txt","w",stdout)
#define fr first
#define sc second
#include <sstream>
#define FIO std::ios_base::sync_with_stdio(false);
#define ii pair < double , int >
#define mp make_pair
using namespace std;
vector < vector < pair < int ,double > > > v;
vector < double > dis;
void bfs(int i)
{
    // v is pairs
    for(int j=0; j<dis.size(); j++)
    {
        dis[j] = 1e15;
    }
    dis[i] = 0;
    priority_queue < ii , vector < ii > , greater < ii >  > q ;
    q.push(ii(0,i));
    while(!q.empty())
    {
        ii R = q.top();
        q.pop();
        double L = R.fr ;
        int  u = R.sc;
        if(L > dis[u])
           continue;
        for(int j=0; j<v[u].size(); j++)
        {
            pair < int , double > node = v[u][j];
            if(dis[node.fr] > dis[u]+node.sc)
            {
                dis[node.fr] = dis[u]+node.sc;
                q.push(ii (dis[node.fr],node.fr));
            }
        }
    }
}
int main()
{
 int a[1019][3];
 cin>>a[0][0]>>a[0][1]>>a[1][0]>>a[1][1];
 a[0][2] = 0;
 a[1][2] = 0;
 int n;
 cin>>n;
 n+=2;
 v.resize(n+100);
 for(int i=2;i<n;i++)
 {
     cin>>a[i][0]>>a[i][1]>>a[i][2];
 }

 for(int i=0;i<n;i++)
 {
     for(int j=0;j<n;j++)
     {
         if(i == j)
            continue;

         double d = hypot((a[i][0] - a[j][0]) , (a[i][1] - a[j][1]));
         d-=(a[i][2]+a[j][2]);
         if(d < 0)
            d = 0;
         v[i].push_back(mp(j,d));
     }
 }
dis.resize(n+100);
bfs(0);
printf("%.10f",dis[1]);
}
/// abacabc


Measured memory_bytes: 20600
class Problem
  attr_accessor :a, :b, :n, :m, :h, :w, :x, :y, :s ,:t, :k, :l

  def initialize
    @n = gets.to_s.to_i
    @a = Array.new(n){ gets.to_s.to_i }
  end

  def solve
    a.sort.uniq.size
  end

  def show(ans)
    puts ans
  end
end

Problem.new.instance_eval do
  show(solve)
end


Measured memory_bytes: 14296
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
			var que = new PriorityQueue<int>(2000000, 1);
			while (true) {
				var input = Console.ReadLine().Split(' ').ToArray();
				if (input[0] == "end") Environment.Exit(0);
				if (input[0][0] == 'i') {
					que.Push(int.Parse(input[1]));
				} else {
					Console.WriteLine(que.Pop());
				}
			}	
        }
    }

	public class PriorityQueue<T> where T : IComparable
	{
		private IComparer<T> _comparer = null;
		private int _type = 0;

		private T[] _heap;
		private int _sz = 0;

		private int _count = 0;

		/// <summary>
		/// Priority Queue with custom comparer
		/// </summary>
		public PriorityQueue(int maxSize, IComparer<T> comparer)
		{
			_heap = new T[maxSize];
			_comparer = comparer;
		}

		/// <summary>
		/// Priority queue
		/// </summary>
		/// <param name="maxSize">max size</param>
		/// <param name="type">0: asc, 1:desc</param>
		public PriorityQueue(int maxSize, int type = 0)
		{
			_heap = new T[maxSize];
			_type = type;
		}

		private int Compare(T x, T y)
		{
			if (_comparer != null) return _comparer.Compare(x, y);
			return _type == 0 ? x.CompareTo(y) : y.CompareTo(x);
		}

		public void Push(T x)
		{
			_count++;

			//node number
			var i = _sz++;

			while (i > 0) {
				//parent node number
				var p = (i - 1) / 2;

				if (Compare(_heap[p], x) <= 0) break;

				_heap[i] = _heap[p];
				i = p;
			}

			_heap[i] = x;
		}

		public T Pop()
		{
			_count--;

			T ret = _heap[0];
			T x = _heap[--_sz];

			int i = 0;
			while (i * 2 + 1 < _sz) {
				//children
				int a = i * 2 + 1;
				int b = i * 2 + 2;

				if (b < _sz && Compare(_heap[b], _heap[a]) < 0) a = b;

				if (Compare(_heap[a], x) >= 0) break;

				_heap[i] = _heap[a];
				i = a;
			}

			_heap[i] = x;

			return ret;
		}

		public int Count()
		{
			return _count;
		}

		public T Peek()
		{
			return _heap[0];
		}

		public bool Contains(T x)
		{
			for (int i = 0; i < _sz; i++) if (x.Equals(_heap[i])) return true;
			return false;
		}

		public void Clear()
		{
			while (this.Count() > 0) this.Pop();
		}

		public IEnumerator<T> GetEnumerator()
		{
			var ret = new List<T>();

			while (this.Count() > 0) {
				ret.Add(this.Pop());
			}

			foreach (var r in ret) {
				this.Push(r);
				yield return r;
			}
		}

		public T[] ToArray()
		{
			T[] array = new T[_sz];
			int i = 0;

			foreach (var r in this) {
				array[i++] = r;
			}

			return array;
		}
	}
}


Measured memory_bytes: 23692
#include <bits/stdc++.h>
using namespace std;
int func(string a,string b){
  if(a.at(a.size()-1)==b.at(0))
    return 1;
  return 0;
}
int main(){
  int N;
  cin>>N;
  vector<string> p(N);
  for(int i=0;i<N;i++)
    cin>>p.at(i);
  int a=1;
  for(int i=0;i<N;i++){
    for(int j=0;j<i;j++){
      if(p.at(j)==p.at(i)){
        a=0;
        break;
      }
    }
  }
  int b=1;
  for(int i=0;i<N-1;i++){
    if(func(p.at(i),p.at(i+1))!=1){
      b=0;
      break;
    }
  }
  if(a==1 && b==1)
    cout<<"Yes"<<endl;
  else 
    cout<<"No"<<endl;
}


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

int main(){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    int a, b, t;
    cin >> a >> b >> t;

    int times = (t + 0.5) / a;
    cout << times * b << endl;
    

}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace Kanazawa
{
    public static class Kaga
    {
        public static void Main()
        {
            var n = Cint();
            var power = 1L;

            Loop(n, i =>
            {
                power = (power * (i + 1)) % 1000000007;
            });

            Cout(power);
        }
        
        #region Input and Output

        private static readonly List<string> Buffer = new List<string>();

        private static string Cin()
        {
            ReadBuffer();

            var str = Buffer.First();
            Buffer.RemoveAt(0);

            return str;
        }

        private static IEnumerable<string> CinA() => Console.ReadLine()?.Split();
        private static int Cint() => int.Parse(Cin());
        private static int[] CintA() => CinA().Select(int.Parse).ToArray();
        private static void Cout(object obj) => Console.WriteLine(obj);

        private static void ReadBuffer()
        {
            if (Buffer.Any()) return;

            var line = Console.ReadLine();
            if (line != null && line.Contains(' '))
            {
                Buffer.AddRange(line.Split());
            }
            else
            {
                Buffer.Add(line);
            }
        }

        #endregion
        #region Loops

        private static void Loop(int count, Action<int> action) => Loop(0, count, action);
        private static void Loop(int init, int count, Action<int> action, int step = 1)
        {
            for (var i = init; i < count + init; i += step)
            {
                action(i);
            }
        }

        #endregion
    }
}


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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < n; i++)
#define REP(n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
using INT64 = long long;
using UINT64 = unsigned long long;

int main(void)
{
    IOS
    vector<int> v(3);
    REP(3) cin >> v[i];

    sort(ALL(v));
    cout << v[0] + v[1]<< endl;



    return 0;
}


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

int n;
vector<int> odd;
vector<int> even;
int firstOdd, numFirstOdd;
int secondOdd, numSecondOdd;
int firstEven, numFirstEven;
int secondEven, numSecondEven;

void input() {
	int n2;
	cin >> n2;
	n = n2 / 2;
	for (int i = 0; i < n2; i++) {
		int a;
		cin >> a;
		if (i % 2 == 1) {
			odd.push_back(a);
		}
		else {
			even.push_back(a);
		}
	}
	sort(odd.begin(), odd.end());
	sort(even.begin(), even.end());
}

void checkVec() {
	numFirstOdd = 0;
	numSecondOdd = 0;
	int num = 0;
	for (int i = 0; i < n - 1; i++) {
		num++;
		if (odd.at(i) != odd.at(i + 1)) {
			if (num > numFirstOdd) {
				secondOdd = firstOdd;
				numSecondOdd = numFirstOdd;
				firstOdd = odd.at(i);
				numFirstOdd = num;
			}
			else if (num > numSecondOdd) {
				secondOdd = odd.at(i);
				numSecondOdd = num;
			}
			num = 0;
		}
	}
	num++;
	if (num > numFirstOdd) {
		secondOdd = firstOdd;
		numSecondOdd = numFirstOdd;
		firstOdd = odd.at(n - 1);
		numFirstOdd = num;
	}
	else if (num > numSecondOdd) {
		secondOdd = odd.at(n - 1);
		numSecondOdd = num;
	}
	num = 0;

	numFirstEven = 0;
	numSecondEven = 0;
	num = 0;
	for (int i = 0; i < n - 1; i++) {
		num++;
		if (even.at(i) != even.at(i + 1)) {
			if (num > numFirstEven) {
				secondEven = firstEven;
				numSecondEven = numFirstEven;
				firstEven = even.at(i);
				numFirstEven = num;
			}
			else if (num > numSecondEven) {
				secondEven = even.at(i);
				numSecondEven = num;
			}
			num = 0;
		}
	}
	num++;
	if (num > numFirstEven) {
		secondEven = firstEven;
		numSecondEven = numFirstEven;
		firstEven = even.at(n - 1);
		numFirstEven = num;
	}
	else if (num > numSecondEven) {
		secondEven = even.at(n - 1);
		numSecondEven = num;
	}
	num = 0;
}

int solve() {
	checkVec();
	if (firstOdd != firstEven) return (n - numFirstOdd) + (n - numFirstEven);
	int num1 = (n - numFirstOdd) + (n - numSecondEven);
	int num2 = (n - numSecondOdd) + (n - numFirstEven);
	return min(num1, num2);
}

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

	input();
	
	cout << solve() << "\n";

	return 0;
}

Measured memory_bytes: 892
import sys
from collections import deque
 
n = int(sys.stdin.readline())
que = deque()
for i in range(n):
    line = sys.stdin.readline()
    op = line.rstrip().split()
    if "insert" == op[0]:
        que.appendleft(op[1])
    elif "delete" == op[0]:
        if op[1] in que:
            que.remove(op[1])
    elif "deleteFirst" == op[0]:
        que.popleft()
    else:
        que.pop()
 
print(*que)

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

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;

#define PB push_back
#define pb push_back
#define MP make_pair

#define sd(n) scanf("%lld", &n)
#define pdn(n) printf("%lld\n", n);
#define pds(n) printf("%lld ", n);
#define endl '\n'

#define forn(a, b, i) for (int i = a; i < b; i += 1)
#define all(v) v.begin(), v.end() 

#define print(stuff) cout << stuff << endl
#define len(stuff) (int) stuff.size()

#define int long long
#define float long double 
#define ll long long
#define ld long double

using vi = vector<int>;
using vb = vector<bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const int inf = (int) 2e18;
const int upper = (int) 3e5 + 50;
const int M = (ll) 1e9 + 7;
const int mod = (ll) 998244353;
const double eps =  1e-8;

int arr[upper];
signed main () {
	start_routine();
	speed();
	#ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);	 
	// freopen("output.txt", "w", stdout);
	// freopen("errlog.txt", "w", stderr);
	#endif

	int n; cin >> n;
	for (int i = 1; i <= 2 * n; i += 1) 
		cin >> arr[i];

	sort(arr + 1, arr + 2 * n + 1);
	int ans = 0;
	for (int i = 1; i <= 2 * n; i += 2) {
		ans += arr[i];
	}
	cout << ans;
 	end_routine();		
}


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

using namespace std;

int main() {
	string str;

	cin >> str;

	if (str[0]==str[1] || str[1]==str[2] || str[2] == str[0]) {
		cout << "No" << endl;
	} else {
		cout << "Yes" << endl;

	}

	return 0;
}

Measured memory_bytes: 256
/*
for (int i = 0; i < N; ++i){}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<int,int> point;
#define rep(i,n) for(i,0,n)
 
int main() {
	// 入力
	int A, B, X;
	cin >> A >> B >> X;
	
	// 解法
	bool ans = false;
	if (A<=X){
		if (X<=A+B) ans = true;
	}
	
	//出力
	if (ans) printf("YES\n");
	else printf("NO\n");
}
 


Measured memory_bytes: 256
x,y,a,b,c = map(int, input().split())
li_p = list(map(int, input().split()))
li_q = list(map(int, input().split()))
li_r = list(map(int, input().split()))
li_p.sort(reverse=True)
li_q.sort(reverse=True)
li_r.sort(reverse=True)
r = []
for i in range(x):
  r.append(li_p[i])
for i in range(y):
  r.append(li_q[i])
for i in range(c):
  r.append(li_r[i])
r.sort(reverse=True)
print(sum(r[:x+y]))


Measured memory_bytes: 29604
{-# LANGUAGE BangPatterns #-}

module Main
  ( main
  )
where

import           Control.Applicative
import           Control.Monad
import           Data.Bits
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import           Data.List
import           Data.Maybe
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as MV
import           Control.Monad.ST
import           Data.Ord
import qualified Data.Vector.Unboxed           as UV

parse = fst . fromJust
parseInt = parse . BS.readInt
parseInteger = parse . BS.readInteger
readInt = parseInt <$> BS.getLine
readInteger = parseInteger <$> BS.getLine
readIntList = map parseInt . BS.words <$> BS.getLine
readIntegerList = map parseInteger . BS.words <$> BS.getLine

main = do
  [a, b, c] <- getLine
  putStrLn $ if a == '7' || b == '7' || c == '7' then "Yes" else "No"


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
bool used[1000001];
int main(){
	cin>>N;
	REP(i,1000001){
		used[i]=false;
	}
	int ans=1;
	while(used[N]==false){
		used[N]=true;
		ans++;
		if(N%2==0){
			N/=2;
		}else{
			N=3*N+1;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

template <typename T>
using V = std::vector<T>;
template <typename T>
vector<T> make_vec(size_t n, T a) {
  return vector<T>(n, a);
}
template <typename... Ts>
auto make_vec(size_t n, Ts... ts) {
  return vector<decltype(make_vec(ts...))>(n, make_vec(ts...));
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << '[';
  for (auto &&e : v) os << e << ' ';
  return os << ']';
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &v) {
  os << '[';
  for (auto &&e : v) os << e << ' ';
  return os << ']';
}

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

struct UnionFind {
  vector<int> data;  // positive: parent, negative: size

  UnionFind() = default;

  explicit UnionFind(size_t sz) : data(sz, -1) {}

  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if (x == y) return false;
    if (data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return true;
  }

  int find(int k) {
    if (data[k] < 0) return k;
    return data[k] = find(data[k]);
  }

  int size(int k) { return -data[find(k)]; }

  bool same(int x, int y) { return find(x) == find(y); }

  vector<int> roots() {
    vector<int> res;
    res.reserve(data.size());
    for (int i = 0; i < (int)data.size(); ++i) {
      if (data[i] < 0) res.push_back(i);
    }
    return res;
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N, M;
  cin >> N >> M;
  UnionFind uf(N);
  REP(i, M) {
    int x, y, z;
    cin >> x >> y >> z;
    x--;
    y--;
    uf.unite(x, y);
  }
  cout << uf.roots().size() << endl;
}


Measured memory_bytes: 3992
/*I MAY NOT GET THE SUCCESS IMMEDIATELY BUT I WILL GET IT FOR SURE*/
#include<bits/stdc++.h>
#define opt std::ios_base::sync_with_stdio(false)
#define I int
#define li      int32_t
#define lli     long long
#define ulli unsigned long long

#define pn          printf("\n")
#define nl          cout<<'\n'
#define sf(N)       scanf("%lld",&N)
#define pf(N)       printf("%lld",N)
#define sl          cout<<' '
#define ps          printf(" ")

#define rep(i,a,b)  for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>b;i--)
#define elif        else if
#define mset(a,b)   memset(a,b,sizeof(a))

#define pb      push_back
#define pob     pop_back
#define itr     iterator
#define sz()    size()
#define szof    sizeof
#define lb      lower_bound
#define ub      upper_bound
#define mp      make_pair
#define vlli    vector<lli>
#define plli    pair<lli,lli>
#define vplli   vector<plli >
#define F       first
#define Sec     second
#define ALL(V)  V.begin(),V.end()
#define Dup erase(unique(V.begin(),V.end()),V.end())

#define Inf     1000000000000000
#define mod     1000000007
using namespace std;

lli Power(lli a,lli b)
{
    lli result=1;

    while(b)
    {
        if(b%2)
        {
            result=(result*a)%mod;
        }

        b=b>>1;
        a=(a*a)%mod;
    }

 return result;
}

int main()
{
    /*#ifndef ONLINE_JUDGE
    freopen("double_squares.txt","r",stdin);
    freopen("double_squares_out.txt","w",stdout);
    #endif // ONLINE_JUDGE*/
    
    int a,b;
    cin>>a>>b;
    
    if(a+b>=10)
    {
        cout<<"error";
        exit(0);
    }
    cout<<a+b;
    
    
    
    









 return 0;
}


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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

//実行部
void Main()
{
  ll h, w; cin >> h >> w;
  ll flag = 0;
  vvc a(h, vc(w)); rep(i, h) rep(j, w) { cin >> a[i][j]; if(a[i][j] == '#') flag++;}
  ll right = 0, down = 0;
  if(a[0][0] != '#') fin("Impossible");
  while(1)
  {
    if(right < h - 1&&a[right + 1][down] == '#')
    {
      right++;
      flag--;
    }
    else if(down < w - 1&&a[right][down + 1] == '#')
    {
      down++;
      flag--;
    }
    else
    {
      break;
    }
  }
  if(flag == 1) fin("Possible");
  else fin("Impossible");
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int S = sc.nextInt();
        int W = sc.nextInt();
        if(W >= S) {
            System.out.println("unsafe");
        }else{
            System.out.println("safe");
        }
    }
}

Measured memory_bytes: 35784
#include <iostream>
using namespace std;
int main(void){
    
    //変数：10進数｢ tenNumber ｣, ４進数｢ foueNumber ｣と置く
    int tenNumber, foueNumber[1000000];
    
    //繰り返し：10進数｢ tenNumber ｣の値が｢ -1 ｣になるまで繰り返し
    while(cin >> tenNumber, tenNumber != -1){
        
        //変数：余りの個数｢ count ｣と置く
        int count = 0;
        
        //繰り返し：余りを求める繰り返し
        while(1){
            
            //計算：余りと商を求めている
            foueNumber[count] = tenNumber % 4;
            tenNumber /= 4;
            
            //条件：余りが無かったら終了
            if(tenNumber == 0) break;
            
            //計算：上の計算より余りがまだあるので余りの数が１個足す
            count++;
        }
        
        //出力：配列の逆から表示する　⇒　ポイント：余りは逆から表示する
        for(int i = count; i >= 0; i--){
            cout << foueNumber[i] << ( (i != 0) ? "" : "\n" );
        }
    }
    
}



Measured memory_bytes: 3088
n,k=map(int,input().split())
listh=[]
for i in range(n):
  listh.append(int(input()))
listh.sort()
ans=10**9
for i in range(n-k+1):
  high=listh[i+k-1]-listh[i]
  if high<ans:
    ans=high

print(ans)

Measured memory_bytes: 13204
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();

		int v[] = new int[50];
		int c[] = new int[50];

		for (int i = 0; i < N; i++) {
			v[i] = scan.nextInt();
		}
		for (int i = 0; i < N; i++) {
			c[i] = scan.nextInt();
		}

		int ans = 0;
		for (int i = 0; i < N; i++) {
			if (v[i] > c[i]) {
				ans += v[i] - c[i];
			}
		}

		System.out.println(ans);
	}
}

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

int main() {
	int n, x; cin >> n >> x;
	vector<int>a(n); for (auto&& xx : a)cin >> xx;
	long long ans = 0;
	if (a[0] > x) { long long dif = a[0] - x; a[0] -= dif; ans += dif; }
	for (int i = 0; i < n-1; i++) {
		if (a[i] + a[i + 1] > x) {
			long long dif = a[i] + a[i + 1] - x;
			ans += dif, a[i + 1] -= dif;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(void)
{
	char str[6];
	scanf("%s",str);
	str[4] = '\0';
	if(str[0] == str[1] || str[1] == str[2]|| str[2] ==str[3])
	{
		printf("Bad\n");
	}
	else
		printf("Good\n");
	return(0);
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

//typedef pair<int,int> P;



int main(){
	bool isprime[300000];

	for(int i=0;i<300000;i++){
		isprime[i] = true;
	}

	for(int i=2;i<300000;i++){
		while(!isprime[i]) i++;
		for(int j=i*2;j<300000;j+=i){
			isprime[j] = false;
		}
	}


	int n;
	scanf("%d", &n);

	int a[100];
	a[0] = 11;
	int tmp = 21;

	for(int i=1;i<n;i++){
		while(!isprime[tmp]) tmp += 10;
		a[i] = tmp;
		tmp += 10;
	}

	for(int i=0;i<n;i++){
		printf("%d ", a[i]);
	}
	printf("\n");

	return 0;
}


Measured memory_bytes: 512
import itertools

N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))

ans = 0
Vsum = []
Csum = []
for i in range(1,N+1):
  Vsum.append(list(itertools.combinations(V, i)))
  Csum.append(list(itertools.combinations(C, i)))

for i in range(N):
  for j in range(len(Vsum[i])):
    if ans <= sum(Vsum[i][j]) - sum(Csum[i][j]):
      ans = sum(Vsum[i][j]) - sum(Csum[i][j])

print(ans)

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

int main() {
 UL H,W,K; cin>>H>>W>>K;
 UL G[6][6];
 rep(y,H) rep(x,W){
  char c; cin>>c;
  G[x][y]=(c=='#'?1:0);
 }
 UL ans=0;
 rep(X,(1<<W)) rep(Y,(1<<H)){
  UL k=0;
  rep(x,W) rep(y,H){
   if(X & (1<<x)) if(Y & (1<<y)) k+=G[x][y];
  }
  if(k==K) ans++;
 }
 cout<<ans<<endl;
 return 0;
}



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

int main() {
  int h, w;
  cin >> h >> w;
  
  vector<vector<char>> a(h, vector<char>(w));
  for (int i=0; i<h; i++) {
    for (int j=0; j<w; j++) {
      cin >> a.at(i).at(j);
    }
  }
  
  vector<int> tate(h, 0);
  vector<int> yoko(w, 0);
  for (int i=0; i<h; i++) {
    for (int j=0; j<w; j++) {
      if (a.at(i).at(j) == '#') {
        tate.at(i)=1;
        yoko.at(j)=1;
      }
    }
  }
  
  for (int i=0; i<h; i++) {
    int e=0;
    for (int j=0; j<w; j++) {
      if (min(tate.at(i), yoko.at(j))) {
        cout << a.at(i).at(j);
        e=1;
      }      
    }
    if (e)
      cout << endl;
  }
}

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

using namespace std;

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

    vector<int> h(n), dp(n, 2e9);
    dp[0] = 0;
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }

    for (int i = 1; i < n; ++i) {
        dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        if (i > 1) dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
    }
    cout << dp[n - 1] << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<cmath>
#include<stack>
#include <algorithm>
#include <functional>
//#include<stdlib.h>
using namespace std;
int main() {
	int n,t=0;
	cin >> n;
	vector<int>k(n);
	vector<bool>l(n-1,false);
	for (int a = 0; a < n; a++)
	{
		cin >> k[a];
		if (a != 0) { if (k[a] - k[a - 1] > 0) { l[a - 1] = true; } }
	}
	for (int a = 0; a < n - 2; a++) { if (l[a] == l[a + 1]) { t++; } }
	cout << t;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
S = input()
r_cnt = S.count('R')
g_cnt = S.count('G')
b_cnt = N - (r_cnt + g_cnt)

ans = r_cnt * g_cnt * b_cnt

for i in range(1,(N//2)+1):
	for j in range(N):
		if j + 2*i >= N:
			break
		tmp = [S[j],S[j+i],S[j+2*i]]
		tmp = list(set(tmp))
		if len(tmp) == 3:
			ans -= 1

print(ans)


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

int main( )
{
    int a, b, x;
    cin >> a >> b >> x;
    double pi = 2 * acos(0.0);
    double p, u, d, theta;
    p = ((2.0 * x) / (a * a * 1.0)) - b;
    if (p <= 0)
    {
        p = (2.0 * x) / (b * a * 1.0);
        u = p;
        d = b;
        //cout << u << " " << d << "\n";
        theta = atan(d / u);
        theta = (theta * 180.0) / pi;
        cout << setprecision(10) << theta << '\n';
    }
    else
    {
        //cout << p << '\n';
        u = a;
        d = b - p;
        //cout << u << " " << d << "\n";
        theta = atan(d / u);
        theta = (theta * 180.0) / pi;
        cout << setprecision(10) << theta << '\n';
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int number[6][6][6]=
{
	{
		{0,0,0,0,0,0},
		{1,2,3,4,5,6},
		{1,3,5,2,4,6},
		{1,4,2,5,3,6},
		{1,5,4,3,2,6},
		{0,0,0,0,0,0},
	},
	{
		{2,1,4,3,6,5},
		{0,0,0,0,0,0},
		{2,3,1,6,4,5},
		{2,4,6,1,3,5},
		{0,0,0,0,0,0},
		{2,6,3,4,1,5},
	},
	{
		{3,1,2,5,6,4},
		{3,2,6,1,5,4},
		{0,0,0,0,0,0},
		{0,0,0,0,0,0},
		{3,5,1,6,2,4},
		{3,6,5,2,1,4},
	},
	{
		{4,1,5,2,6,3},
		{4,2,1,6,5,3},
		{0,0,0,0,0,0},
		{0,0,0,0,0,0},
		{4,5,6,1,2,3},
		{4,6,2,5,1,3},
	},
	{
		{5,1,3,4,6,2},
		{0,0,0,0,0,0},
		{5,3,6,1,4,2},
		{5,4,1,6,3,2},
		{0,0,0,0,0,0},
		{5,6,4,3,1,2},
	},
	{
		{0,0,0,0,0,0},
		{6,2,4,3,5,1},
		{6,3,2,5,4,1},
		{6,4,5,2,3,1},
		{6,5,3,4,2,1},
		{0,0,0,0,0,0},
	},
};
int N;
vector<int>ans;
int top[27];
int frt[27];
void dfs(int id)
{
	if(id==27)
	{
		int now=0;
		for(int i=2;i<27;i+=3)now+=number[top[i]-1][frt[i]-1][2];
		ans.push_back(now);
		return;
	}
	int stot=top[id],stof=frt[id];
	int t=id<9?stot:7-number[top[id-9]-1][frt[id-9]-1][5];
	int lt=t?t:1,rt=t?t:6;
	for(int nowt=lt;nowt<=rt;nowt++)
	{
		int f=id%9<3?stof:7-number[top[id-3]-1][frt[id-3]-1][4];
		int lf=f?f:1,rf=f?f:6;
		for(int nowf=lf;nowf<=rf;nowf++)
		{
			int left=number[nowt-1][nowf-1][3];
			if(left==0)continue;
			if(id%3!=0&&7-number[top[id-1]-1][frt[id-1]-1][2]!=left)continue;
			top[id]=nowt;frt[id]=nowf;
			dfs(id+1);
		}
	}
	top[id]=stot;frt[id]=stof;
}
main()
{
	cin>>N;
	for(int ccc=0;ccc<N;ccc++)
	{
		ans.clear();
		for(int i=0;i<27;i++)top[i]=frt[i]=0;
		cin>>top[6]>>top[7]>>top[8]>>top[3]>>top[4]>>top[5]>>top[0]>>top[1]>>top[2];
		cin>>frt[0]>>frt[1]>>frt[2]>>frt[9]>>frt[10]>>frt[11]>>frt[18]>>frt[19]>>frt[20];
		dfs(0);
		if(ans.empty())
		{
			cout<<0<<endl;
		}
		else
		{
			sort(ans.begin(),ans.end());
			ans.erase(unique(ans.begin(),ans.end()),ans.end());
			for(int i=0;i<ans.size();i++)cout<<ans[i]<<(i+1==ans.size()?"\n":" ");
		}
	}
}



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

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> p(n);
    rep(i,n){cin >> p[i];}

    sort(p.begin(),p.end());
    int sum = 0;
    rep(i,k){sum += p[i];}

    cout << sum << endl;
    
}

Measured memory_bytes: 3640
n = int(input())

for i in range(1,n+1):
    x = i
    if i % 3 == 0:
        print(" ",end="")
        print(i,end="")
    else:
        while True:
            if x == 0:
                break
            if x % 10 == 3:
                print(" ",end="")
                print(i,end="")
                break
            x = int(x/10)

print("")


Measured memory_bytes: 6164
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;

int main()
{
    std::string s;
    std::cin >> s;

    for (int i = 0; i < s.length() / 2; i++) {
        std::cout << s[i * 2];
    }
    if (s.length() % 2) {
        std::cout << s[s.length() - 1];
    }
    std::cout << std::endl;
}


Measured memory_bytes: 512
from math import ceil
# トリボナッチ数列
dp = [1, 1, 2]
for i in range(3, 31):
    dp.append(dp[i-1] + dp[i-2] + dp[i-3])

while True:
    a = int(input())
    if a == 0:
        break
    print(ceil(dp[a]/10/365))


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

map<pll, ll> mp;
vector<ll> G[101010];
vector<bool> visited(101010, false);

int dfs(ll now, ll par){
	ll out = 0;
	visited[now] = true;
	REP(i, G[now].size()){
		ll next = G[now][i];
		if(next == par) continue;
		if(visited[next]){
			ll dir = mp[{now, next}];
			if(dir == 0){
				out++;
				mp[{now, next}] = 1;
				mp[{next, now}] = -1;
			}
		}else{
			out += dfs(next, now);
		}
	}

	if(par == -1) return (out+1)%2;

	if(out%2 == 0){
		mp[{par, now}] = 1;
		mp[{now, par}] = -1;
		return 1;
	}else{
		mp[{par, now}] = -1;
		mp[{now, par}] = 1;
		return 0;
	}
	return (out+1)%2;
}

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

    ll N, M;
    cin >> N >> M;
    REP(i, M){
    	ll A, B;
    	cin >> A >> B;
    	A--, B--;
    	G[A].push_back(B);
    	G[B].push_back(A);
    	mp[{A, B}] = 0;
    	mp[{B, A}] = 0;
    }

    ll res = dfs(0, -1);
    if(res == 1){
    	for(auto x: mp){
    		if(x.second == 1){
    			cout << x.first.first+1 << " " << x.first.second+1 << endl;
    		}
    	}
    }else{
    	cout << -1 << endl;
    }
    return 0;
}

Measured memory_bytes: 35072
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(min(b, d) - max(a, c), 0) << endl;
    return 0;
}



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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

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

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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; }

void Main(){
    int N; cin >> N;
    VI A(N+1); REP(i,N+1) cin >> A[i];
    VI B(N); REP(i,N) cin >> B[i];

    ll ans = 0;
    REP(i,N){
        int t = min(A[i],B[i]);
        ans += t;
        A[i] -= t;
        B[i] -= t;

        t = min(A[i+1],B[i]);
        ans += t;
        A[i+1] -= t;
        B[i] -= t;
    }

    cout << ans << en;
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}

Measured memory_bytes: 3960
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#if __cplusplus >= 201103L
#include <chrono>
using namespace std::chrono;
#endif
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#ifdef LOCAL
#define prln(x) (cout << #x << ' ' << x << endl)
#define pr(x) (cout << #x << ' ' << x << ' ' )
#define prv(x) (cout << x << ' ')
#else
#define prln(x) 
#define pr(x)
#define prv(x)
#endif
#define clr(x) memset((x), 0, sizeof((x)))
#define clr1(x) memset((x), -1, sizeof((x)))
#define endl "\n"
#define pi acos(-1)
#define rep(i, st, ed) for (int i = (st); i <= (ed); ++i)
#define rep0(i, st, ed) for (int i = (st); i < (ed); ++i)
#define per0(i, st, ed) for (int i = (st); i > ed; --i)
#define per(i, st, ed) for (int i = (st); i >= ed; --i)
#define chmin(a, b) (a = a > b ? b : a)
#define chmax(a, b) (a = a < b ? b : a)
template<class T> void _sf(T &x) {cin >> x;}
void _sf(int &x) {scanf("%d", &x);}
void _sf(ll &x) {scanf("%lld", &x);}
void _sf(double &x) {scanf("%lf", &x);}
void _sf(char &x) {scanf(" %c", &x);}
void _sf(char *x) {scanf("%s", x);}
void sf() {}
template <class T, class...U> void sf(T & head, U&... tail) { _sf(head); sf(tail...);}
template<class T> void _out(const T &x) { cout << x; }
void _out(const int &x) { printf("%d", x); }
void _out(const ll &x) { printf("%lld", x); }
void _out(const double &x) { printf("%.16f", x); }
void _out(const char &x) { putchar(x); }
void _out(const char *x) { printf("%s", x); }
template<class T,class U> void _out(const pair<T,U> &x) {_out(x.F); putchar(' '); _out(x.S);}
template<class T> void _out(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _out(*i++)) if (i != x.cbegin()) putchar(' '); }
void out() {}
template<class T, class... U> void out(const T &head, const U &... tail) { _out(head); putchar(sizeof...(tail) ? ' ' : '\n'); out(tail...); }
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;

int read() {
    int x = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    return x * f;
}
// const int maxn = 1e5 + 5;
const int N=1e5+5;
bool mark[N];
int prim[N];
int cnt;
void initial()
{
    cnt=0;
    for (int i=2 ; i<N ; ++i)
    {
        if (!mark[i])
            prim[cnt++]=i;
        for (int j=0 ; j<cnt && i*prim[j]<N ; ++j)
        {
            mark[i*prim[j]]=1;
            if (!(i%prim[j]))
                break;
        }
    }
}


int main(){
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    // string s, t;
    // sf(s, t);
    // cout << t << s << endl;
    int x;
    sf(x);
    initial();
    prln(prim[cnt - 1]);
    int a = *lower_bound(prim, prim + cnt, x);
    out(a);
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
    using namespace std;
    
    int main(){
        long  n , a , b , c;
        cin >> n;
        vector<long> va, vb, vc;
        for(long i = 0; i < n ; i++){
            cin >> a;
            va.push_back(a);
        }
        for(long i = 0; i < n ; i++){
            cin >> b;
            vb.push_back(b);
        }
        for(long i = 0; i < n ; i++){
            cin >> c;
            vc.push_back(c);
        }
        sort(va.begin(), va.end());
        sort(vb.begin(), vb.end());
        sort(vc.begin(), vc.end());
        
        vector<long> suma, sumc;
        suma.assign(n , 0);
        sumc.assign(n , 0);
        long ans = 0; 
        for(long i = 0; i < n ; i++){
            auto itr1 = lower_bound(va.begin(), va.end(), vb[i]);
            suma[i] = itr1 - va.begin() ;
            auto itr2 = upper_bound(vc.begin(), vc.end(), vb[i]);
            sumc[i] = vc.end() - itr2;
            ans += suma[i] * sumc[i];
        }
        
        cout << ans << endl;
        /*
        if (suma.size() > 0){
            cout << suma[0];
            for ( int i = 1; i < suma.size() ; i++){
                cout << " " << suma[i] ;
            }
        cout << endl;
        }
        if (sumc.size() > 0){
            cout << sumc[0];
            for ( int i = 1; i < sumc.size() ; i++){
                cout << " " << sumc[i] ;
            }
        cout << endl;
        }
        */

        
        
        return 0;
    }

Measured memory_bytes: 4340
#include <bits/stdc++.h>
using namespace std;
#define Me3za() ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);srand(time(NULL))
#define endl "\n"
int n,k;
int l;
int arr[100005];
long long mem[100005];
long long solve(int i,long long cur){
if(i>=n-1)return 0;
if(mem[i]!=-1)return mem[i];
mem[i]=LLONG_MAX;
for(int j=1;i+j<=min(i+k,n-1);j++){
   long long sol=solve(i+j,arr[i+j])+abs(cur-arr[i+j]);
   mem[i]=min(sol,mem[i]);
}
return mem[i];
}
int main() {
Me3za();
cin>>n>>k;
for(int i=0;i<n;i++){
    cin>>arr[i];
}
memset(mem,-1,sizeof mem);
cout<<solve(0,arr[0]);
}



Measured memory_bytes: 6144
#include<iostream>
using namespace std;
int main(){
    int x,y;
    while(1){
        cin >> x >>y;
        if(x==0&&y==0)break;
        if(x<y){
            cout << x <<" "<< y <<endl;
        }else{
            cout<<y<<" "<<x<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3008
# Problem B - Increment Decrement

# input process
N = int(input())
S = input()

# initialization
max_score = 0
tmp = 0

# count process
for i in range(N):
    if S[i]=='I':
        tmp += 1
    else:
        tmp -= 1
    max_score = max(max_score, tmp)

print(max_score)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define print(n) std::cout << n << std::endl
using namespace std;
const int N = 1000000;


int main() {
    int n,m;
    cin >> n >> m;

    vector<int> x(n + 1);
    vector<int> y(m + 1);
    cin >> x[0] >> y[0];

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

    for (int i = 0; i < m; ++i) {
        cin >> y[i + 1];
    }
    
    if(*max_element(x.begin(),x.end()) < *min_element(y.begin(),y.end()))print("No War");
    else print("War");

}

Measured memory_bytes: 256
#include <iostream>

#define sc second
#define fr first
#define mk make_pair
#define pb push_back
#define int long long

using namespace std;

const int N = (1e6 + 5);
const int inf = (1e18 + 7);
int a,b,c;

main () {
    cin >> a >> b >> c;

    cout << (a + b + c >= 22 ? "bust" : "win") << endl;
}


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

int main() {
  long long n, a, b ;
  cin >> n >> a >> b ;

  long long l = a + b ;

  long long amari = n % l ;
  long long shou = n / l ;
  if ( amari <= a ) {
    cout << shou * a + amari << endl ;
  }else{
    cout << shou * a + a << endl ;
  }

  return 0 ;
}


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


public class Main{
    
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                int K = scan.nextInt();
               
                int n = -1;
                
                if(K%2==0){
                    System.out.println(n);
                }else{
                    n=n+2;
                    long p = 7;
                    for(long i=1; i<=K; i++){
                        if(i==1){
                            if(p%K==0){ 
                                break;
                            }
                            p = (p*10+7)%K;
                        }else{                           
                            if(p%K==0){ 
                                break;
                            }
                            p = (p*10+7)%K;
                        }
                        n++;
                        if(i==K){
                            System.out.println(-1);
                            System.exit(0);
                        }
                    }
                    
                    System.out.println(n);
                }
        }
}

Measured memory_bytes: 35844
N, M = map(int, input().split())
a = []
b = []
if M == 0:
    for i in range(1,(2*N)+1):
        if i%2==0 and i>0:
            a.append(i)
elif N == 0:
    for i in range(1,(2*M)+1):
        if i%2==1:
            b.append(i)
else:
    for i in range(1,501):
        if i%2==0 and i>0:
            a.append(i)
        else:
            b.append(i)
c = a[:N] + b[:M]
l = []
num = 1
for i in range(len(c)-1):
    for j in range(num,len(c)):
        res = c[i] + c[j]
        l.append(res)
    num+=1

k=[i for i in l if i%2==0]
print(len(k))

Measured memory_bytes: 3444
s = int(input())
ptn = []
n = 1
while True:
    ptn.append(s)

    if s % 2 == 0:
        fn = s // 2
    else:
        fn = s * 3 + 1

    if fn in ptn:
        print(n+1)
        exit()

    ptn.append(fn)
    n += 1
    s = fn

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b; char c; cin>>a>>c>>b;
    if (c=='+') cout<<a+b<<"\n";
    else cout<<a-b<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int H, W;
	int i, j;

	while (1)
	{
		scanf("%d %d", &H, &W);
		if ((H == 0) && (W == 0))
		{
			break;
		}
			for (i = 0;i < H;i++)
			{
				for (j = 0;j < W;j++)
				{
					if ((i + j) % 2 == 0)
					{
						printf("#");
					}
					else
					{
						printf(".");
					}
				}
				printf("\n");
			}
			printf("\n");

	}
}


Measured memory_bytes: 2104