akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main(){
    int N;
    cin >> N;
    deque<int> deq;
    REP(i, N){
        int x;
        cin >> x;
        if(i % 2 == 0) deq.push_back(x);
        else deq.push_front(x);
    }
    
    REP(i , N){
        if(0 < i) cout << " ";

        int x;
        if(N % 2 == 0) x = deq.front(), deq.pop_front();
        else x = deq.back(), deq.pop_back();
        cout << x;
    }

    cout << endl;
}

Measured memory_bytes: 2944
import itertools

N,K = (int(x) for x in input().split())

max_k = (N-1)*(N-2)//2

if K > max_k:
    print(-1)
    exit()

graph_pair_arr = []
for i in range(1,N):
    graph_pair_arr.append((0,i))

dec_left = max_k-K
for i,j in itertools.combinations(list(range(1,N)), 2):
    if dec_left == 0:
        break
    graph_pair_arr.append((i,j))
    dec_left -= 1

print(len(graph_pair_arr))
for i,j in graph_pair_arr:
    print(i+1,j+1)


Measured memory_bytes: 3992
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n,q,m;
	while(cin>>n>>q){
		if(n==0&&q==0) break;
		int num[100];
		for(int i=0;i<100;i++){
			num[i]=0;
		}
		for(int i=0;i<n;i++){
			cin>>m;
			int d[m];
			for(int j=0;j<m;j++){
				cin>>d[j];
				num[d[j]]++;
			}
		}
		int k=0,ma=0;
		for(int i=0;i<100;i++){
			if(num[i]>ma&&num[i]>=q){
				k=i;
			}
			ma=max(ma,num[i]);
		}
		cout<<k<<endl;
	}
    return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
 
int main() {
  long long N,A,B;
  cin >> N >> A >> B;
  if((B-A)%2==0){
    cout << (B-A)/2 << endl;
  }else{
    cout << min(A-1, N-B)+1+(B-A)/2 << endl;
  }
  return 0;
}

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
#define INF 10000000000
#define MAX 1000010
#define MOD 1000000007
  
using ll = long long;
using Graph = vector<vector<pair<ll,ll>>>;

int main(){
  ll N,K; cin>>N>>K;
  ll res = 0;
  for(ll b = 1; b <= N; b++){
    ll r = N%b;
    ll p = N/b;
    res += p*max((ll)0,b-K)+max((ll)0,r-K+1);
    if(K==0)res--;
  }
  cout<<res<<endl;
}

Measured memory_bytes: 256
n = int(input())
S = list(map(int,input().split()))
q = int(input())
T = list(map(int,input().split()))
cnt = 0

def binary_search(l,num):
    left = 0
    right = n
    flag = 0
    while left < right:
        mid = (left + right)//2
        if l[mid] == num:
            flag = 1
            return(flag)
        elif l[mid] > num:
            right = mid
        else:
            left = mid + 1
    return(flag)
    
for i in T:
    cnt += binary_search(S,i)
print(cnt)


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

// #include <boost/algorithm/string/join.hpp>
// using boost::algorithm::join;
//
// #include "boost/multi_array.hpp"
// boost::multi_array<int, 3> dp;
// dp.resize(boost::extents[10][9][8]);
//
// #include <boost/multiprecision/cpp_dec_float.hpp>  // quite slowly
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision; // mp::log10
// using bigint = boost::multiprecision::cpp_int;
// using rational = mp::cpp_rational;  // double d = static_cast<double>(r);

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

//constexpr ll MOD = 1e9+7;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/4;
constexpr int INF=inf<int>;
constexpr ll LINF=inf<ll>;

#define Sort(x) sort(begin(x),end(x))
#define Reverse(x) reverse(begin(x),end(x))
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ull<<(n))
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,v) REP(i,(v).size())

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
#define endl "\n"
  }
} before_main_function;

// ========== end of template ==========
ll N, M, D;
map<ll, double> cache;

// 長さmの配列の美しさの期待値
double E(ll m) {
  assert(m>=2);
  if (cache[m] > 0) return cache[m];

  if (m==2) {
    double ret = D==0 ? 1.0/N : 2.0*(N-D)/N/N;
    cache[m] = ret;
    return ret;
  }

  double ret = 0.0;
  if (m%2) {
    // odd
    ret = E(m/2+1) + E(m/2+1);
  } else {
    ret = E(m/2)*2 + E(2);
  }

  cache[m] = ret;
  return ret;
}

int main(int argc, char** argv) {
  cin >> N >> M >> D;

  cout << E(M) << endl;

  //REP(i, 2, M+1) {
  //  cout << "m " << i << ": " << E(i) << endl;
  //}

  return 0;
}

/* vim: set expandtab shiftwidth=2 softtabstop=2 : */


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

#define all(x) (x).begin(),(x).end()
#define fastio ios_base::sync_with_stdio(false)

typedef double db;
typedef long long ll;
typedef unsigned long long ull;

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


const int maxn = 1e5 + 5;

bool ok[maxn];

void sieve() {
	for(int i = 2; i <= sqrt(maxn); ++i) {
		if(!ok[i]) {
			for(int j = i * i; j <= maxn; j+=i) {
				ok[j] = 1;
			}
		}
	}
}
int main() {
	fastio;
	sieve();
	int x; cin >> x;
	for(int i = x; i <= maxn; ++i) {
		if(!ok[i]) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef vector<int> vi;
#define sz(c) int((c).size())

typedef vector<vi> vvi;

const int fsize = 8;

int sx, sy;
vvi f(fsize+1, vi(fsize+1, 0));

vi dx = {-3, -2, -1,  1,  2,  3,  0,  0,  0,  0,  0,  0};
vi dy = { 0,  0,  0,  0,  0,  0, -3, -2, -1,  1,  2,  3};

void dfs(int x, int y)
{
  f[y][x] = 0;
  for (int i = 0; i < sz(dx); i++) {
    int nx = x + dx[i], ny = y + dy[i];
    if (0 < nx && nx <= fsize && 0 < ny && ny <= fsize && f[ny][nx])
      dfs(nx, ny);
  }
}

void BombsChain()
{
  dfs(sx, sy);
  for (int y = 1; y <= fsize; y++) {
    for (int x = 1; x <= fsize; x++) {
      cout << f[y][x];
    }
    cout << endl;
  }
}

int main(int argc, char **argv)
{
  int cnr;
  char c;
  cin >> cnr;
  for (int i = 1; i <= cnr; i++) {
    cin.ignore(); // \n
    cin.ignore(); // \n
    for (int y = 1; y <= fsize; y++) {
      for (int x = 1; x <= fsize; x++) {
        cin.get(c);
        f[y][x] = (c == '1');
      }
      cin.ignore();
    }
    cin >> sx >> sy;
    cout << "Data " << i << ":" << endl;
    BombsChain();
  }

  return 0;
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long int64;
 
 
int main()
{
  int64 L;
  int N;
  int64 S[100000], T[100000], A[200001];
  A[0] = 0;
 
  scanf("%lld", &L);
  scanf("%d", &N);
  for(int i = 0; i < N; i++) {
    scanf("%lld %lld", &S[i], &T[i]);
    A[i + 1] = T[i] - S[i] + A[i];
  }
 
  int64 ret = 0, tail = 0;
  for(int i = 0; i < N; i++) {
    int64 start = S[i], end = S[i] + L - 1;
    while(tail + 1 < N && end > S[tail + 1]) ++tail;
    ret = max(ret, A[tail] - A[i] + max(0LL, min(T[tail] - 1, end) - S[tail] + 1));
  }
  printf("%lld\n", ret);
}

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

using namespace std;

typedef unsigned long long ll;

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


int main(){
    int n, m;

    cin >> n >> m;

    vector<int> s(m);
    vector<int> c(m);

    rep(i, m) cin >> s[i] >> c[i];

    int res_num = 0;
    int res = 0;
    vector<int> pas_(m,0);
    int fla = 0;

    rep(i, m){

        for(int j = i+1; j < m; j++) {
            if (s[i] == s[j]){
                if(c[i] == c[j]) pas_[j] = -1;
                else {
                    res = -1;
                    break;
                }
            }
        }

        if(res == -1) continue;
        if(pas_[i] == -1) continue;
        if(n-s[i] != 0 && c[i] == 0) res = -1; 
        else {
                rep(k, n-s[i]) c[i] = c[i] * 10;
                res_num += c[i];
                if(s[i] == 1) fla = 1;
             }
    }

    if(fla == 0) res_num += 1 * pow(10, n-1);
    if(m==0){
    if(n == 1) res_num = 0;
    if(n == 2) res_num = 10;
    if(n ==3) res_num = 100;
    }

    
    if(res == -1) cout << res;
    else cout << res_num;

    return 0;

}

Measured memory_bytes: 512
# include "stdio.h"

int main(){
    int n;
    scanf("%d",&n);
    int a[n];
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    int f[100000];
    for(int i=0;i<100000;i++)
        f[i]=0;
    for(int i=0;i<n;i++)
        f[a[i]]++;
    int c0=0,c2=0,out=0;
    if((n%2&&f[0]==1)||(n%2==0)){
        for(int i=1;i<100000;i++){
            if(f[i]==2)  c2++;
            if(f[i]!=0&&f[i]!=2) out=1;
        }
    }else{
        printf("0\n");
        return 0;
    }
    if(out){
      printf("0\n");
      return 0;
    }
    int ans=1;
    for(int i=0;i<c2;i++){
          ans*=2;
          ans=ans%1000000007;
    }
    printf("%d\n",ans%1000000007);


}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int l, r, sum = 0;
		for (int i = 0; i < n; i++) {
			l = sc.nextInt();
			r = sc.nextInt();
			sum += r - l + 1;
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 24532
#include <stdio.h>

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

Measured memory_bytes: 572
#include <iostream>

using namespace std;

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

  int min = abs(stoi(S.substr(0, 3)) - 753);
  for (int i = 0; i < S.size() - 2; i++) {
    if (abs(stoi(S.substr(i, 3)) - 753) < min)
      min = abs(stoi(S.substr(i, 3)) - 753);
  }

  cout << min << endl;

  return 0;
}

Measured memory_bytes: 256
local mfl = math.floor
local function getgcd(x, y)
  while 0 < x do
    x, y = y % x, x
  end
  return y
end

local n, m = io.read("*n", "*n", "*l")
local s = io.read()
local t = io.read()
local gcd = getgcd(n, m)
local lcm = mfl(n / gcd) * m
local step_s = mfl(m / gcd)
local step_t = mfl(n / gcd)
local tbl = {}
local sstr = ""
for i = 1, n do
  local pos = 1 + (i - 1) * step_s
  sstr = s:sub(i, i)
  tbl[pos] = sstr
end
local f = true
for i = 1, m do
  local pos = 1 + (i - 1) * step_t
  if tbl[pos] ~= nil and tbl[pos] ~= t:sub(i, i) then
    f = false
    break
  end
end
print(f and lcm or -1)


Measured memory_bytes: 5292
N, x = map(int, input().split())
A = [0] + list(map(int, input().split())) + [0]
ans = 0
for i in range(N + 1):
    if A[i] + A[i + 1] > x:
        tmp = A[i] + A[i + 1] - x
        ans += tmp
        A[i + 1] -= tmp
print(ans)


Measured memory_bytes: 19968
n, m=map(int, input().split())
cake=[list(map(int, input().split())) for _ in range(n)]

cakes=[[] for _ in range(8)]
for c in cake:
    cakes[0].append(c[0]+c[1]+c[2])
    cakes[1].append(c[0]+c[1]-c[2])
    cakes[2].append(c[0]-c[1]+c[2])
    cakes[3].append(c[0]-c[1]-c[2])
    cakes[4].append(-c[0]+c[1]+c[2])
    cakes[5].append(-c[0]+c[1]-c[2])
    cakes[6].append(-c[0]-c[1]+c[2])
    cakes[7].append(-c[0]-c[1]-c[2])
for c in cakes:
    c.sort(reverse=True)
ans=0
for i in range(8):
    ans=max(ans, sum(cakes[i][:m]))
print(ans)

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

int dp[100005];

int main(){
    int x; cin >> x;
    rep(i,6) dp[100+i] = 1;
    for(int i = 200; i <= x; ++i){
        for(int j = 100; j <= 105; ++j){
            if(dp[i-j]==1) dp[i]=1;
        }
    }
    cout << dp[x] << endl;
}

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

#define N 101

int M[N][N];//&#65533;&#1488;&#1677;s&#65533;
int d[N];//&#65533;m&#65533;[&#65533;h&#65533;&#784;&#65533;
int pi[N];//&#65533;&#450;&#65533;&#65533;&#65533;&#65533;&#30152;&#65533;&#65533;&#65533;&#65533;

void initi();
int BFS(int start,int goal);


main(){
  initi();
  int n;
  cin >> n;
  for(int i = 0; i< n ; i++){
    int Bangou,setuzokusu;
    cin >> Bangou;
    cin >> setuzokusu;
    for(int j=0;j < setuzokusu ; j++){
      int to;
      cin >> to;
      M[Bangou][to]=1;
    }
  }//&#65533;f&#65533;[&#65533;^&#65533;&#787;&#65533;&#65533;&#834;&#65533;&#65533;&#65533;&#65533;&#1794;
  
  
  cin >> n;
  for(int i = 0; i < n;i++){
    int start,goal,TTL,result;
    cin >> start >> goal >> TTL;
    if ( (result =BFS(start,goal)+1) > TTL)cout << "NA" << endl;
    else cout << result << endl;
  }
  
  
  
  
  return 0;     
}


void initi(){
        for(int i=0;i<N;i++){
                for(int j=0;j<N;j++)M[i][j]=0;
        }
}

int BFS(int start,int goal){
        
  queue<int> Q;//&#65533;L&#65533;&#65533;&#65533;[&#65533;&#65533;&#65533;p&#65533;
  for(int i=0;i<N;i++){
    d[i] =1 << 21;
    pi[i]=0;
  }
  
  d[start]=0;
  Q.push(start);
  
  while(!Q.empty()){//&#65533;L&#65533;&#65533;&#65533;[&#65533;&#65533;&#65533;&#65533;&#65533;&#578;&#514;&#65533;&#65533;&#1794;&#322;&#65533;&#65533;
    int u=Q.front();
    Q.pop();
    //  cout << "Now u is" << u << endl;
    for(int v = 0 ; v <N ; v++){
      if (M[u][v] && d[v] == 1 << 21){//u&#65533;&#65533;&#65533;&#65533;v&#65533;&#589;s&#65533;&#65533;&#65533;&#269;X&#65533;&#65533;v&#65533;&#771;X&#65533;^&#65533;[&#65533;g&#65533;n&#65533;_&#65533;&#65533;&#65533;&#65533;&#65533;&#779;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#337;&#65533;&#65533;&#782;&#65533;
        d[v]=d[u]+1;
        pi[v]=u;//&#65533;&#450;&#65533;&#65533;&#65533;&#65533;&#30152;&#65533;&#65533;&#65533;&#65533;
        Q.push(v);
        //cout <<"from "  <<u << "to" <<v << endl;
      }
    }
  }

  //for(int i=1;i<8;i++)cout << d[i]<< " ";
  //cout << endl;
  
  
  return d[goal];
        
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;


    if(c>=a && c<=b)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }


    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	d := scanInt()
	fmt.Fprintln(wr, "Christmas "+strings.Repeat("Eve ", abs(25-d)))
}


Measured memory_bytes: 1780
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const double PI = 3.1415926535897932;
const int MOD = 1e9 + 7;

//cin.tie(0);ios::sync_with_stdio(false);
int main() {
  int n;
  cin >> n;
  vector<int> a;
  a.push_back(0);
  rep (i, n) { 
    int x; cin >> x;
    a.push_back(x);
  }
  a.push_back(0);

  ll sum = 0;
  for (int i = 1; i < n + 2; i++) {
    sum += abs(a[i] - a[i - 1]);
    //printf("abs(a[%d] - a[%d]) = %d\n", i, i - 1, abs(a[i] - a[i - 1]));
  }

  for (int i = 1;  i < n + 1; i++) {
    ll tmp = sum;
    tmp -= abs(a[i] - a[i - 1]);
    tmp -= abs(a[i + 1] - a[i]);
    tmp += abs(a[i - 1] - a[i + 1]);
    cout << tmp << endl;
  }

  //printVec(a);

  //printf("sum = %d\n", sum);

  return 0;
}


Measured memory_bytes: 3904
#include<stdio.h>

int main(void){
	while(1){
		int a,b,m;
		scanf("%d%d",&a,&b);
		if(a==0&&b==0)break;
		scanf("%d",&m);
		
		int masu[20][20]={0};
		for(int i=0;i<m;i++){
			int aa,bb;
			scanf("%d%d",&aa,&bb);
			masu[aa][bb]=1;
		}
		
		int dp[20][20]={0};
		dp[1][1]=1;
		
		for(int i=1;i<=a;i++){
			for(int j=1;j<=b;j++){
				if(masu[i+1][j]==0) dp[i+1][j]+=dp[i][j];
				if(masu[i][j+1]==0) dp[i][j+1]+=dp[i][j];
			}
		}
		
		printf("%d\n",dp[a][b]);
	}
}

Measured memory_bytes: 0
#include <stdio.h>

void swap(int *a, int *b) {
  int tmp;
 
  tmp = *a;
  *a = *b;
  *b = tmp;
}

int main(void) {
  int x, y;

  for (; scanf("%d %d", &x, &y), x != y || x != 0 ;) {
    if (x > y) {
      swap(&x, &y);
    }

    printf("%d %d\n", x, y);
  }

  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <map>
using namespace std;
int main(){
    int n, a;
    cin >> n;
    map<int,int>mp;
    for(int i=0; i<n; i++){
        cin >> a;
        mp[a]++;
        mp[a+1]++;
        mp[a-1]++;
    }
    int M = 0;
    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
             M = max(itr->second,M);
    }
    cout << M << endl;
    return 0;
}

Measured memory_bytes: 7904
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace __gnu_pbds;
using namespace std;
//typedef
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
//constants
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
// gcd of a and b
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
// distance between (a,b) and (c,d)
long double dis(long long a,long long b,long long c,long long d){return sqrt( ((a)-(c))*((a)-(c))+((b)-(d))*((b)-(d)) );}
// simple prime check
bool isprime(long long a){
if(a==2)return 1;
if(!(a&1))return 0;
for(ll i=3;i*i<=a;i+=2){
	if(a%i==0)return 0;
}
return 1;
}
// fast expo
long long mpow(long long base,long long exponent,long long modulus){
if(modulus==1)return 0;
long long result = 1;
base=base%modulus;
while(exponent){
		if(exponent%2 == 1)
			result=(result*base)%modulus;
		exponent=exponent>>1;
		base=(base*base)%modulus;
	}
return result;
}
// modular inverse
ll minv(ll a,ll mod){
	ll _gcd=gcd(a,mod);
	assert(_gcd==1);
	return mpow(a,mod-2,mod);
}

/*
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/

/*
ll dx[]={1,0,-1,0,1,1,-1,-1};
ll dy[]={0,-1,0,1,1,-1,-1,1};
*/

/*
void sieve(int N){
	for(int i=0;i<=N;i++){
		spf[i]=i;
	}
	for(int i=2;i*i<=N;i++){
		if(spf[i]==i){
			for(int j=i*i;j<=N;j+=i){
				spf[j]=min(spf[j],i);
			}
		}
	}
	return;
}
*/

/*
void nCr(ll n,ll k){
	ll i,j;
	for(i=0;i<=n;i++){
		for(j=0;j<=min(i,k);j++){

			if(j==0 or j==i)C[i][j]=1LL;
			else  C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD;

		}
	}
	return;
}
*/
/*
ll ncr(ll N,ll K){
	if(N<K)return 0;
	if(K==0)return 1;
	if(N==0)return 0;

	ll den=1;
	for(ll i=1;i<=K;i++)den*=i;
	ll num=1;
	while(K--){
		num*=N;
		if(num%den==0){
			num/=den;
			den=1;
		}
		N--;
	}

	return num;
}
*/
ll x,a;
int main(){FAST;
cin>>x>>a;
if(x<a)cout<<0;
else cout<<10;
return 0;
}

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

int main(){
    long N, K;
    cin >> N >> K;
    long x[N];
    for(int i = 0; i < N; i++) cin >> x[i];
    long ans = LONG_MAX;
    for(int i = 0; i + K <= N; i++){
        if(x[i + K - 1] <= 0) ans = min(ans, abs(x[i]));
        else if(x[i] <= 0) ans = min(ans, min(abs(x[i]), x[i + K - 1]) + x[i + K - 1] - x[i]);
        else ans = min(ans, x[i + K - 1]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
A, B, C, X, Y = list(map(int, input().split()))
ans = 10**20
for nc in range(0, max(X,Y)*2+1, 2):
    na = max(X-nc//2, 0)
    nb = max(Y-nc//2, 0)
    ans = min(ans, na*A+nb*B+nc*C)
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
const int N  =  2e5 + 5, MOD  =  1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

vector<int> v;

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int r, d, x;
    cin>>r>>d>>x;

    for(int i = 1; i <= 10; i++){
        v.pb(r*x - d);
        x = r*x - d;
    }
    sort(v.begin(), v.end());
    for(auto u: v)  cout<<u<<endl;

    return 0;
}


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

stores = [list(map(int, input().split())) for x in range(n)]
p = [list(map(int, input().split())) for x in range(n)]


best_value = -float("inf")
for flg in range(1, 2**10):
    bit = [(flg >> v) & 1 for v in range(10)]
    c = [0 for x in range(n)]
    for i in range(n):
        for v1, v2 in zip(bit, stores[i]):
            if v1 == v2 == 1:
                c[i] += 1
    benefit = 0
    for i, c_value in enumerate(c):
        benefit += p[i][c_value]
    best_value = max(best_value, benefit)
print(best_value)


Measured memory_bytes: 3064
//Radhe Radhe
#include<bits/stdc++.h>
#define godspeed  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define rep1(i,a,b)    for(ll i=a; i<=b; i++)
#define repVect(i,n)    for(ll i=0; i<sum.size(); i++)
#define fixed cout.setf(ios::fixed);
#define Precise cout.precision(7);
#define yes cout<<"Yes"<<'\n';
#define no cout<<"No"<<'\n';
using namespace std;

int main()
{
    godspeed
    ll  t,i,x,y,c,j,k,n,a,b,m,minia=INT_MAX,minib=INT_MAX;
    string s;
    vector<ll>price;
    cin>>a>>b>>m;
    ll ar[a],br[b];
    for(i=0; i<a; i++)
    {
        cin>>ar[i];
        minia=min(ar[i],minia);
    }
    for(i=0; i<b; i++)
    {
        cin>>br[i];
        minib=min(br[i],minib);
    }
    ll emniPai=minia+minib;
    while(m--)
    {
        cin>>x>>y>>c;
        price.push_back(ar[x-1]+br[y-1]-c);
    }

    cout<<min(emniPai,*min_element(price.begin(),price.end()))<<endl;
    return 0;
}





Measured memory_bytes: 5848
#include<iostream>
#include<math.h>
using namespace std;

bool isPrime(int x){
  if(x==2){
    return true;
  }
  if(x<2 || x%2==0){
    return false;
  }

  int i=3;
  while(i<=sqrt(x)){
    if(x%i==0){
      return false;
    }
    i = i+2;
  }

  return true;
}

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

  int N[n];
  int c=0;
  for(int i=0;i<n;i++){
    cin >> N[i];
    if(isPrime(N[i])){
      c++;
    }
  }
  cout << c << endl;

  return 0;
}



Measured memory_bytes: 3096
#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>
#include <numeric>
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))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
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;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };




signed main() {
	ll a, b;


	cin >> a >> b;

	if (a > b) {
		int num = a - b;

		if (num % 2 != 0) {
			cout << "IMPOSSIBLE" << endl;
		}
		else {
			num /= 2;
			num += b;
			cout << num << endl;
		}
	}
	else if (a < b) {
		int num = b - a;

		if (num % 2 != 0) {
			cout << "IMPOSSIBLE" << endl;
		}
		else {
			num /= 2;
			num += a;
			cout << num << endl;
		}
	}
	else if (a == b) {
		cout << 0 << endl;
	}



	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
    int N;
    
    scanf("%d",&N);
  	char S[N];
    scanf("%s",S);
    int i;
    int count=0;
    for(i=0;i<N-1;i++){
        if(S[i] != S[i+1])
        count++;
    }

    printf("%d",count+1);
}

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

class aizu_judge
{
    static void Main()
    {
        int[] num = System.Console.ReadLine().Split().Select(int.Parse).ToArray();
        int result = num[0] - num[1];

        if (result > 0)
            Console.WriteLine("a > b");
        else if (result < 0)
            Console.WriteLine("a < b");
        else
            Console.WriteLine("a == b");
    }
}

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

int main(){
	double side1, side2, diagonal, rectangle, rhombus;
	char x, y;
	while(cin >> side1 >> x >> side2 >> y >> diagonal){
		if(pow(side1, 2.0) + pow(side2, 2.0) == pow(diagonal, 2.0) && side1 != side2){
			rectangle++;
		}
		else if(pow(side1, 2.0) + pow(side2, 2.0) != pow(diagonal, 2.0) && side1 == side2){
			rhombus++;
		}
	}

	cout << rectangle << endl << rhombus << endl;
}

Measured memory_bytes: 1276
/*
 * Created by KeigoOgawa
 */


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <cmath>

#define INF (int)1e8
#define EPS 1e-10
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define RFOR(i, a, b) for (ll i = (b)-1; i >= (a); i--)
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define MIN(a, b) (a > b ? b : a)
#define MAX(a, b) (a > b ? a : b)
#define debug(x) cerr << #x << ": " << x << endl
#define all(a) (a).begin(), (a).end()

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int, int> PII;

// vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len - 1) s << "\t";
    }
    return s;
}

// 2 dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
    int len = vv.size();
    for (int i = 0; i < len; ++i) {
        s << vv[i] << endl;
    }
    return s;
}

int N;
vector<int> a;


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

    cin >> N;
    int posi = 0, posi_i = 0;
    int nega = 0, nega_i = 0;

    REP(i, N) {
        int t;
        cin >> t;
        if (t > 0 && t > posi) {
            posi = t;
            posi_i = i;
        } else if (t < 0 && t < nega) {
            nega = t;
            nega_i = i;
        }
        a.push_back(t);
    }
    int m = 0, mi = 0;
    if (posi + nega > 0) {
        // 最大値の絶対値の方が大きい
        m = posi;
        mi = posi_i;
    } else {
        m = nega;
        mi = nega_i;
    }

    // 符号を合わせる
    cout << 2 * N - 1 << endl;
    REP(i, N) {
        cout << mi+1 << " " << i+1 << endl;
        a[i] += m;
    }

    REP(i, N-1) {
        if (m >= 0) {
            a[i+1] += a[i];
            cout << i+1 << " " << i+2 << endl;
        } else {
            a[N-i-2] += a[N -1 - i];
            cout << N - i << " " << N - i - 1 << endl;
        }
    }

    return 0;
}


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

int main()
{
  int h,w;cin>>h>>w;
  vector<vector<char>> s(h+2,vector<char>(w+2));
  int i,j;
  for(i=0;i<=h+1;i++)
  {
    for(j=0;j<=w+1;j++)
    {
      if(i==0||j==0||i==h+1||j==w+1)s.at(i).at(j)='#';
      else cin>>s.at(i).at(j);
    }
  }
  int si=-1;
  int sj=-1;
  int ans=-1;
  for(si=1;si<=h;si++)
  {
    for(sj=1;sj<=w;sj++){
      if(s.at(si).at(sj)=='#')continue;
  vector<vector<int>> tm1(h+2,vector<int>(w+2,INF));
  queue<int> q;
  queue<int> q2;
  q.push((si-1)*w+sj);
  tm1.at(si).at(sj)=0;
  int dis=1;
  while(!q.empty())
  {
    while(!q.empty()){
    int now=q.front();
    q.pop();
    int nowj=now%w;
    int nowi;
    if(nowj==0)
    {
      nowj=w;
      nowi=now/w;
    }
    else
    {
      nowi=now/w+1;
    }
    if(s.at(nowi-1).at(nowj)=='.'&&tm1.at(nowi-1).at(nowj)==INF&&nowi>1)
    {
      tm1.at(nowi-1).at(nowj)=dis;
      q2.push((nowi-2)*w+nowj);
    }
    if(s.at(nowi+1).at(nowj)=='.'&&tm1.at(nowi+1).at(nowj)==INF&&nowi<h)
    {
      tm1.at(nowi+1).at(nowj)=dis;
      q2.push((nowi)*w+nowj);
    }
    if(s.at(nowi).at(nowj-1)=='.'&&tm1.at(nowi).at(nowj-1)==INF&&nowj>1)
    {
      tm1.at(nowi).at(nowj-1)=dis;
      q2.push((nowi-1)*w+nowj-1);
    }
    if(s.at(nowi).at(nowj+1)=='.'&&tm1.at(nowi).at(nowj+1)==INF&&nowj<w)
    {
      tm1.at(nowi).at(nowj+1)=dis;
      q2.push((nowi-1)*w+nowj+1);
    }}
    dis++;
    while(!q2.empty())
    {
      q.push(q2.front());
      q2.pop();
    }
  }
  for(i=1;i<=h;i++)
  {
    for(j=1;j<=w;j++)
    {
      if(tm1.at(i).at(j)>ans&&tm1.at(i).at(j)!=INF)
      {
        ans=tm1.at(i).at(j);
      }
    }
  }
    }
  }
  cout<<ans<<endl;
}


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

struct UnionFind {
    vector<int> data;

    explicit UnionFind(int size) : data(size, -1) {}

    bool merge(int x, int y) {
        x = root(x);
        y = root(y);
        if (x != y) {
            if (data[y] < data[x])
                swap(x, y);
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }

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

    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }

    int size(int x) {
        return -data[root(x)];
    }
};

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

int main() {
    int N, M; cin >> N >> M;

    UnionFind uf(N);
    REP(i, M) {
        int A, B; cin >> A >> B; --A; --B;
        uf.merge(A, B);
    }

    int ans = 0;
    REP(i, N) {
        ans = max(ans, uf.size(i));
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3604
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	io, flush := NewIO()
	defer flush()

	n := io.ScanInt()
	prices := io.ScanInts(n)
	sort.Ints(prices)

	fmt.Println(Sum(prices...) - prices[n-1]/2)
}

func Sum(nums ...int) (sum int) {
	for _, n := range nums {
		sum += n
	}
	return sum
}

type IO struct {
	scanner *bufio.Scanner
	writer  *bufio.Writer
}

func NewIO() (*IO, func()) {
	io := &IO{
		scanner: newScanner(),
		writer:  newWriter(),
	}
	return io, func() { io.writer.Flush() }
}

func newScanner() *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Buffer(make([]byte, 10000000), 10000000)
	s.Split(bufio.ScanWords)
	return s
}

func newWriter() *bufio.Writer {
	return bufio.NewWriter(os.Stdout)
}

func (io *IO) ScanBytes() []byte {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Bytes()
}

func (io *IO) ScanString() string {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Text()
}

func (io *IO) ScanStrings(n int) []string {
	strs := make([]string, n)
	for i := 0; i < n; i++ {
		strs[i] = io.ScanString()
	}
	return strs
}

func (io *IO) Scan2DStrings(y, x int) [][]string {
	strings := make([][]string, y)
	for i := 0; i < y; i++ {
		strings[i] = io.ScanStrings(x)
	}
	return strings
}

func (io *IO) Scan2DGraph(y int) [][]string {
	strs := make([][]string, y)
	for i := 0; i < y; i++ {
		strs[i] = strings.Split(io.ScanString(), "")
	}
	return strs
}

func (io *IO) ScanInt() int {
	return int(io.ScanInt64())
}

func (io *IO) ScanInt2() (int, int) {
	return int(io.ScanInt64()), int(io.ScanInt64())
}

func (io *IO) ScanInt3() (int, int, int) {
	return int(io.ScanInt64()), int(io.ScanInt64()), int(io.ScanInt64())
}

func (io *IO) ScanInt4() (int, int, int, int) {
	return int(io.ScanInt64()), int(io.ScanInt64()), int(io.ScanInt64()), int(io.ScanInt64())
}

func (io *IO) ScanInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = io.ScanInt()
	}
	return ints
}

func (io *IO) Scan2DInts(y, x int) [][]int {
	ints := make([][]int, y)
	for i := 0; i < y; i++ {
		ints[i] = io.ScanInts(x)
	}
	return ints
}

func (io *IO) ScanInt64() int64 {
	i, err := strconv.ParseInt(io.ScanString(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *IO) ScanFloat64() float64 {
	i, _ := strconv.ParseFloat(io.ScanString(), 64)
	return i
}

func (io *IO) ScanFloat64s(n int) []float64 {
	floats := make([]float64, n)
	for i := 0; i < n; i++ {
		floats[i] = io.ScanFloat64()
	}
	return floats
}

func (io *IO) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N;
    cin >> N;
    vec A(N);
    REP(i,0,N) cin >> A[i];

    vec C(8, 0);
    ll cnt1 = 0, cnt2 = 0;
    REP(i,0,N) {
        if(A[i] < 3200) C[A[i]/400] = 1;
        else ++cnt2;
    }
    REP(i,0,8) cnt1 += C[i];
    PS(MAX(1,cnt1));
    PR(cnt1+cnt2);

    return 0;
}

/*



*/

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
int n,ans,w[105][105],p[105],a[105],b[105],c[105],d[105],vis[105];
int hungary(int u){
	for(int v=0;v<n;v++){
		if(!w[u][v]||vis[v])continue;
		vis[v]=1;
		if(p[v]==-1||hungary(p[v])){
			p[v]=u;return 1;
		}
	}
	return 0;
}
int main(){cin>>n;
	for(int i=0;i<n;i++)cin>>a[i]>>b[i];
	for(int i=0;i<n;i++)cin>>c[i]>>d[i];
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(a[i]<c[j]&&b[i]<d[j])w[i][j]=1;
		}
	}
	memset(p,-1,sizeof(p));
	for(int i=0;i<n;i++){memset(vis,0,sizeof(vis));ans+=hungary(i);}
	cout<<ans;
}


Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int main(void) {
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int M1 = 0;
  int M2 = 0;
  for (int i = 0; i < N; i++) {
    if (M1 < A[i]) {
      M2 = M1;
      M1 = A[i];
    } else if (M2 < A[i]) {
      M2 = A[i];
    }
  }
  for (int i = 0; i < N; i++) {
    if (A[i] == M1) {
      cout << M2 << endl;
    } else {
      cout << M1 << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 2432
#include <iostream>
int main() {
  int N,a,b,c;
  std::cin >> N;
  for (int i = 0; i < N; i++) {
    std::cin >> a >> b >> c;
    if (a*a+b*b==c*c ||
        b*b+c*c==a*a ||
        c*c+a*a==b*b) {
      std::cout << "YES";
    } else {
      std::cout << "NO";
    }
    std::cout << std::endl;
  }
}

Measured memory_bytes: 1152
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int a = scan.nextInt(), b = scan.nextInt(), c = scan.nextInt();

        int tmp = a;
        a = b;
        b = tmp;

        tmp = a;
        a = c;
        c = tmp;

        System.out.println(a + " " + b + " " + c);

        scan.close();
        return;
    }
}

Measured memory_bytes: 39332
MOD = 998244353

N, K = map(int, input().split())
segments = [tuple(map(int, input().split())) for _ in range(K)]
dp = [0] * (2 * N + 1)
for i in range(N):
    for s, t in segments:
        t += 1
        dp[i + s] += dp[i] if i != 0 else 1
        dp[i + t] -= dp[i] if i != 0 else 1
    dp[i + 1] += dp[i]
    dp[i + 1] %= MOD
print(dp[N - 1])

Measured memory_bytes: 24696
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MAXN 1000010
#define rep(i, n) for(int i = 0; i < (n); ++i)
const ll mod = 1e9 + 7;

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

bool pairCompare(const P &firstElof, const P &secondElof) {
    return firstElof.second < secondElof.second;
}

int main() {
    string s, t;
    cin >> s;
    cin >> t;
    int ans = t.size();

    for(int i = 0; i < (s.size() - t.size() + 1); ++i) {
        int tmp = 0;
        rep(k, t.size()) {
            if(s[i + k] != t[k]) {
                tmp++;
            }
        }
        ans = min(ans, tmp);
    }

    cout << ans << endl;
}


Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;
#define INT(x) int x; scanf("%d",&x)
#define INPUT(x) scanf("%d",&x)
#define REP1(x,n) for(int x = 0; x < n; x++)
#define REP2(x,s,e) for(int x = s; x <= e; x++)
#define BR printf("\n")
#define INF 2000000000

int main(){
    int _5 = 0,_7 = 0;
    REP1(i,3){
        INT(j);
        if (j == 5) {
            _5++;
        }else if(j == 7){
            _7++;
        }
    }
    if (_7 == 1 && _5 == 2) {
        printf("YES\n");
    }else{
        printf("NO\n");
    }
    return 0;
}

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

int f[2003][2003][2];//0:x 1:y
int n,m,x,ans;
char ch[2003];
int main()
{
	scanf("%d %d", &n,&m);
	for (int i=1;i<=n;++i)
	{
		scanf("%s", ch+1);
		for (int j=1;j<=m;++j)
		{
			if (ch[j]=='.')
			{
				f[i][j][1]=f[i][j][0]=1;
				f[i][j][0]+=f[i-1][j][0];
				f[i][j][1]+=f[i][j-1][1];
			}
		}
	}
	for (int i=n;i>0;--i)
	{
		for (int j=m;j>0;--j)
		{
			if (f[i][j][0]!=0)f[i][j][0]=max(f[i][j][0],f[i+1][j][0]);
			if (f[i][j][1]!=0)f[i][j][1]=max(f[i][j][1],f[i][j+1][1]);
			ans=max(ans,f[i][j][0]+f[i][j][1]-1);
		}
	}
	printf("%d\n",ans);
	return 0;
}


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

int main() {
	int n;
	string s;
	cin >> n;
	cin >> s;
	int l = s.length();
	for(int i = 0; i < l; ++i){
		int a = s[i];
		
		int t = ((a % 65 + n % 65) % 65 ) % 26 ;
		s[i] = (char)(t + 'A');
	}
	cout << s;
}

Measured memory_bytes: 256
require 'prime'

q = gets.chomp.to_i

ls = []
rs = []
a = Array.new(10 ** 5, nil)
b = Array.new(10 ** 5, nil)
c = Array.new(10 ** 5, 0)
max = 0

q.times do
  l, r = gets.chomp.split(" ").map(&:to_i)
  ls << l
  rs << r
  max = r if r > max
end

Prime.each(max).each { |prime| a[prime] = true }

(1..max).each do |i|
  b[i] = a[i] && a[(i+1)/2]
end

(1..max).each do |i|
  c[i] = c[i-1]
  c[i] += 1 if b[i]
end

q.times do |i|
  l = ls[i]
  r = rs[i]
  puts c[r] - c[l-1]
end


Measured memory_bytes: 8948
#include <iostream>
#include <sstream>
#include <cstring>
//#include <fstream>

using namespace std;

int osenbei[10][10000];
bool upsidedown[10];

int count_one (int col, int size )
{
	int i;
	int res = 0;

	for (i = 0; i < size; ++i){
		if ( ( upsidedown[i] && osenbei[i][col] == 0 )
		||   (!upsidedown[i] && osenbei[i][col] == 1 ) ){
			++res;
		} // end if
	} // end for

	return res;
}
	
int main()
{
//	cut here before submit 
//	freopen ("testcase.osenbei2", "r", stdin );
	int r,c;

	while (1){
		cin >> r >> c;

		if (r == 0 && c == 0 ){
			break;
		} // end if
		memset (osenbei, 0, sizeof (osenbei ) );
		
		int i,j;

		for (i = 0; i < r; ++i){
			for (j = 0; j < c; ++j){
				cin >> osenbei[i][j];
			} // end for
		} // end for

		int res = 1000000;

		// each row is all-search
		for (i = 0; i < (1 << r); ++i){
			memset (upsidedown, false, sizeof (upsidedown ) );
			for (j = 0; j < r; ++j){
				if (i & (1 << j ) ){
					upsidedown[j] = true;
				} // end if
			} // end for

			// eash col 
			// count number of 1,  automatically get number of 0.
			// return min number of 1 and number of 0.
			int sum = 0;
			for (j = 0; j < c; ++j){
				int one = count_one (j, r );
				int zero = r - one;
				sum += min (one, zero );
			} // end for
			res = min (res, sum );
		} // end for
		cout << (r*c - res) << endl;	

	} // end loop
		
	return 0;
}

Measured memory_bytes: 1256
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use proconio::*;
use std::collections::VecDeque;
use std::io::stdin;
use std::str::FromStr;
use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let mut sc = Scanner::new();
    let n = sc.next_usize();

    let mut ans = 0;
    for i in 1..=n {
        ans += n / i;
        if n % i == 0 {
            ans -= 1;
        }
    }

    println!("{}", ans);
}

pub struct Scanner {
    buf: VecDeque<String>,
}

impl Scanner {
    pub fn new() -> Self {
        Self {
            buf: VecDeque::new(),
        }
    }

    fn scan_line(&mut self) {
        let mut flag = 0;
        while self.buf.is_empty() {
            let mut s = String::new();
            stdin().read_line(&mut s).unwrap();
            let mut iter = s.split_whitespace().peekable();
            if iter.peek().is_none() {
                if flag >= 5 {
                    panic!("There is no input!");
                }
                flag += 1;
                continue;
            }

            for si in iter {
                self.buf.push_back(si.to_string());
            }
        }
    }

    pub fn next<T: FromStr>(&mut self) -> T {
        self.scan_line();
        self.buf
            .pop_front()
            .unwrap()
            .parse()
            .unwrap_or_else(|_| panic!("Couldn't parse!"))
    }

    pub fn next_usize(&mut self) -> usize {
        self.next()
    }

    pub fn next_isize(&mut self) -> isize {
        self.next()
    }

    pub fn next_chars(&mut self) -> Vec<char> {
        self.next::<String>().chars().collect_vec()
    }

    pub fn next_string(&mut self) -> String {
        self.next()
    }

    pub fn fill_vec_line<T: FromStr>(&mut self, v: &mut Vec<T>) {
        for vi in v {
            *vi = self.next();
        }
    }

    pub fn fill_vec<T: FromStr>(&mut self, v: &mut Vec<Vec<T>>) {
        for vi in v {
            for vii in vi {
                *vii = self.next();
            }
        }
    }

    pub fn make_vec_line<T: FromStr + Default + Clone>(&mut self, i: usize) -> Vec<T> {
        let mut v = vec![Default::default(); i];
        self.fill_vec_line(&mut v);
        v
    }

    pub fn make_vec<T: FromStr + Default + Clone>(&mut self, i: usize, j: usize) -> Vec<Vec<T>> {
        let mut v = vec![vec![Default::default(); j]; i];
        self.fill_vec(&mut v);
        v
    }
}


Measured memory_bytes: 2120
from collections import deque


def BFS(x,y):
    color=[["white" for _ in range(w)] for _ in range(h)]
    D=[[0 for _ in range(w)] for _ in range(h)]

    color[x][y]="gray"
    D[x][y]=0
    queue=deque([[x,y]])

    num=0
    while len(queue)>0:
        a,b=queue.popleft()
        for c,d in [[1,0],[-1,0],[0,1],[0,-1]]:
            X,Y=a+c,b+d
            if 0<=X<h and 0<=Y<w:
                if color[X][Y]=="white" and S[X][Y]==".":
                    D[X][Y]=D[a][b]+1
                    num=max(num,D[X][Y])
                    color[X][Y]="gray"
                    queue.append([X,Y])
        color[a][b]="black"
    
    return num


h,w=map(int,input().split())
S=[list(input()) for _ in range(h)]

ans=0
for i in range(h):
    for j in range(w):
        if S[i][j]==".":
            ans=max(ans,BFS(i,j))

print(ans)

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

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main()
{
    // 整数の入力
	long long int n,k;
    long long int a[2000];
    int count=0,b_count=0;
    long long int counts=0;
    const long long int mod = 1e9+7;  	
  
    cin >> n >> k;
    for(int i=0;i<n;i++){
       cin >> a[i];
    }
 
    for(int i=0;i<n;i++){
       for(int j=0;j<n;j++){
           if(a[i]>a[j]){
             //cout << "ai " << a[i] << " aj " << a[j] << endl;
               if(j>i){
                   count++;
               }
             if(j<i){
               b_count++;
             }
           }
       }
    }
    counts = (k*(k-1)/2%mod*b_count%mod + k*(k+1)/2%mod*count%mod)%mod;
    //cout << b_count << endl;
  	//cout << count << endl;
    cout << counts << endl;
    return 0;
}

Measured memory_bytes: 256
local S, T = io.read("l","l")
local function match(i)
    local ss = S:sub(i, i+#T-1)
    for k=1,#T do
        local c = ss:sub(k,k)
        local d = T:sub(k,k)
        if c == '?' then
        elseif c == d then
        else
            return false
        end
    end
    return true
end
for i=#S-#T+1,1,-1 do
    if match(i) then
        local t = {}
        for k=1,i-1 do
            local c = S:sub(k,k)
            if c == '?' then
                table.insert(t, 'a')
            else
                table.insert(t, c)
            end
        end
        for k=i,i+#T-1 do
            table.insert(t, T:sub(k-i+1,k-i+1))
        end
        for k=i+#T,#S do
            local c = S:sub(k,k)
            if c == '?' then
                table.insert(t, 'a')
            else
                table.insert(t, c)
            end
        end
        print(table.concat(t, ""))
        return
    end
end
print("UNRESTORABLE")

Measured memory_bytes: 888