akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <functional>

using namespace std;

#define INF 10000000000

typedef pair<long long int, long long int> P;

int main() {
	long long int n, l;
	cin >> n >> l;
	vector<long long int> d(n);
	for (int i = 0; i < n; i++) {
		cin >> d[i];
	}
	vector<long long int> t(n, INF);
	priority_queue<P, vector<P>, greater<P> > pq;
	for (int i = 0; i < n; i++) {
		if (i == 0) {
			if (d[i] > d[i+1]) {
				pq.push(P(l-d[i], i));
			}
		} else if (i == n-1) {
			if (d[i] > d[i-1]) {
				pq.push(P(l-d[i], i));
			}
		} else {
			if (d[i] > d[i+1] && d[i] > d[i-1]) {
				pq.push(P(l-d[i], i));
			}
		}
	}
	long long int tt = 0;
	while (!pq.empty()) {
		P pp = pq.top();
		pq.pop();
		long long int a, b;
		a = pp.first;
		b = pp.second;
		t[b] = a;
		tt = max(tt, a);
		if (b == 0) {
			if (d[b+1] < d[b]) {
				if (b+1 == n-1) {
					pq.push(P(a+(l-d[b+1]), b+1));
				} else {
					if (d[b+2] > d[b+1]) {
						if (t[b+2] != INF) {
							pq.push(P(max(a, t[b+2])+(l-d[b+1]), b+1));
						}
					} else {
						pq.push(P(a+(l-d[b+1]), b+1));
					}
				}
			}
		} else if (b == n-1) {
			if (d[b-1] < d[b]) {
				if (b-1 == 0) {
					pq.push(P(a+(l-d[b-1]), b-1));
				} else {
					if (d[b-2] > d[b-1]) {
						if (t[b-2] != INF) {
							pq.push(P(max(a, t[b-2])+(l-d[b-1]), b-1));
						}
					} else {
						pq.push(P(a+(l-d[b-1]), b-1));
					}
				}
			}
		} else {
			if (d[b+1] < d[b]) {
				if (b+1 == n-1) {
					pq.push(P(a+(l-d[b+1]), b+1));
				} else{
					if (d[b+2] > d[b+1]) {
						if (t[b+2] != INF) {
							pq.push(P(max(a, t[b+2])+(l-d[b+1]), b+1));
						}
					} else {
						pq.push(P(a+(l-d[b+1]), b+1));
					}
				}
			}
			if (d[b-1] < d[b]) {
				if (b-1 == 0) {
					pq.push(P(a+(l-d[b-1]), b-1));
				} else {
					if (d[b-2] > d[b-1]) {
						if (t[b-2] != INF) {
							pq.push(P(max(a, t[b-2])+(l-d[b-1]), b-1));
						}
					} else {
						pq.push(P(a+(l-d[b-1]), b-1));
					}
				}
			}
		}
	}
	cout << tt << endl;
	return 0;
}

Measured memory_bytes: 3616
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iomanip>
#include <iostream> // cout, endl, cin
#include <map>      // map
#include <math.h>
#include <numeric>
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <string>        // string, to_string, stoi
#include <tuple>         // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int INF = 1001001001;
const int BG = 1000000007;

int findSumOfDigits(int n)
{
    int sum = 0;
    while (n > 0)
    {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

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

    int mini = 100000;

    rep2(i, 1, (N / 2) + 1)
    {
        int a = i;
        int b = N - i;
        int tmp = 0;
        tmp += findSumOfDigits(a);
        tmp += findSumOfDigits(b);
        mini = min(mini, tmp);
    }
    cout << mini << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  char a;
  cin>>a;
  if(a=='a'||a=='b'||a=='c'||a=='d'||a=='e'||a=='f'||a=='g'||a=='h'||a=='i'||a=='j'||a=='k'||a=='l'||a=='m'||a=='n'||a=='o'||a=='p'||a=='q'||a=='r'||a=='s'||a=='t'||a=='u'||a=='v'||a=='w'||a=='x'||a=='y'||a=='z')
    cout<<"a"<<endl;
  else
    cout<<"A"<<endl;
    
}

Measured memory_bytes: 3620
A = list(list(map(int,input().split()))for _ in range(3))

N = int(input())
for _ in range(N):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j] == b:
                A[i][j] = 0

for i in range(3):
    count = 0
    for j in range(3):
        if A[i][j] != 0:
            break
        count += 1
    if count == 3:
        print("Yes")
        exit()

for i in range(3):
    count = 0
    for j in range(3):
        if A[j][i] != 0:
            break
        count += 1
    if count == 3:
        print("Yes")
        exit()

count = 0
for i in range(3):
    if A[i][i] != 0:
        break
    count += 1
if count == 3:
    print("Yes")
    exit()

count = 0
for i in range(3):
    if A[i][2-i] != 0:
        break
    count += 1
if count == 3:
    print("Yes")
    exit()

print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (long long i = 0; i < (n); ++i)
#define rep(i, a, b) for (long long i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    long long h, w;
    cin >> h >> w;
    long long minv = 1e16;
    for (long long i = 1; i < h; i++)
    {
        long long s[3];
        s[0] = i * w;

        // tate bunkatu
        s[1] = (w / 2) * (h - i);
        s[2] = h * w - s[0] - s[1];
        sort(s, s + 3);
        if (minv > s[2] - s[0])
            minv = s[2] - s[0];

        // yoko bunkatu
        if ((h - i) < 2)
            continue;
        s[0] = i * w;
        s[1] = w * ((h - i) / 2);
        s[2] = h * w - s[0] - s[1];
        sort(s, s + 3);
        if (minv > s[2] - s[0])
            minv = s[2] - s[0];
    }

    swap(h, w);
    for (long long i = 1; i < h; i++)
    {
        long long s[3];
        s[0] = i * w;

        // tate bunkatu
        s[1] = (w / 2) * (h - i);
        s[2] = h * w - s[0] - s[1];
        sort(s, s + 3);
        if (minv > s[2] - s[0])
            minv = s[2] - s[0];

        // yoko bunkatu
        if ((h - i) < 2)
            continue;
        s[0] = i * w;
        s[1] = w * ((h - i) / 2);
        s[2] = h * w - s[0] - s[1];
        sort(s, s + 3);
        if (minv > s[2] - s[0])
            minv = s[2] - s[0];
    }

    cout << minv << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

struct stack{
	int num;
	int data[10];
};

void push(struct stack *st, int n){
	st->data[st->num] = n;
	st->num++;
	return;
}
int pop(struct stack *st){
	return st->data[--(st->num)];
}

int main(void){
	struct stack st;
	int n;
	st.num=0;
	while(scanf("%d", &n) != EOF){
		if(n == 0){
			printf("%d\n", pop(&st));
		}else{
			push(&st, n);
		}
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define MAXN 100000

using namespace std;

pair <int, int> v[MAXN + 1];

int main() {
  //  fstream cin("A.in");
  //  ofstream cout("A.out");
    int n, i;
    ios::sync_with_stdio(false);
    cin >> n;
    for(i = 1; i <= n; i++) {
        cin >> v[i].first;
        v[i].second = i;
    }
    sort(v + 1, v + n + 1);
    int ans = 0;
    for(i = 1; i <= n; i++)
        if(v[i].second % 2 != i % 2)
            ans++;
    cout << (ans + 1) / 2 << endl;
   // cin.close();
   // cout.close();
    return 0;
}


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

using namespace std;
int N;
const int MAX_N = 11;
double x[MAX_N], y[MAX_N];
string u[MAX_N];

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> u[i];
		if (u[i] == "JPY") {
			y[i] = 1;
		}
		else {
			y[i] = 380000.0;
		}
	}
	double sum = 0;
	for (int i = 0; i < N; i++) {
		sum += x[i] * y[i];
	}

	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    int N, M;
    cin >> N >> M;
    vector<vector<int>> s(M);
    REP(i, M) {
        int k;
        cin >> k;
        s[i].resize(k);
        REP(j, k) {
            cin >> s[i][j];
            s[i][j]--;
        }
    }
    vector<int> p(M);
    REP(i, M) {
        cin >> p[i];
    }
    int res = 0;
    REP(bit, 1 << N) {
        auto ok = [&]() {
            REP(i, M) {
                int sum = 0;
                for (auto &k : s[i]) {
                    sum += (bit >> k & 1);
                }
                if (sum % 2 != p[i]) {
                    return 0;
                }
            }
            return 1;
        };
        res += ok();
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3644
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const long long INF=1LL << 60;




int main() {
  string s;
  cin>>s;
  if(s=="SUN"){
    cout<<7<<endl;
  }
  if(s=="SAT"){
    cout<<1<<endl;
  }
  if(s=="FRI"){
    cout<<2<<endl;
  }
  if(s=="THU"){
    cout<<3<<endl;
  }
  if(s=="WED"){
    cout<<4<<endl;
  }
  if(s=="TUE"){
    cout<<5<<endl;
  }
  if(s=="MON"){
    cout<<6<<endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>

using namespace std;

bool FLG;
int max_depth;

struct Node{
	Node(){
		p = q = 0;
		left = right = left_child = right_child = parent = -1;
	}
	long long int p,q,left_child,right_child,parent,left,right;
};

long long int getCommon(long long int x,long long int y){
	if(y == 0){
		return x;
	}else{
		return getCommon(y,x%y);
	}
}

void calc(Node nodes[],int id){

	long long int common,tmp;

	if(nodes[id].left_child > 0){
		calc(nodes,nodes[id].left_child);
	}
	if(nodes[id].right_child > 0){
		calc(nodes,nodes[id].right_child);
	}

	if(nodes[id].left*nodes[id].p > nodes[id].right*nodes[id].q){
		common = getCommon(nodes[id].left*nodes[id].p,nodes[id].right*nodes[id].q);
	}else{
		common = getCommon(nodes[id].right*nodes[id].q,nodes[id].left*nodes[id].p);
	}

	tmp = ((nodes[id].right*nodes[id].q)/common)*nodes[id].left*nodes[id].p;

	nodes[id].left = tmp/nodes[id].p;
	nodes[id].right = tmp/nodes[id].q;

	if(nodes[id].parent == -1)return;

	if(nodes[nodes[id].parent].left_child == id){
		nodes[nodes[id].parent].left = nodes[id].left + nodes[id].right;
	}else{
		nodes[nodes[id].parent].right = nodes[id].left + nodes[id].right;
	}
}

void func(int num_of_bar){
	long long int root,left,right;
	long long int common;
	Node nodes[num_of_bar+1];

	for(int i = 1; i <= num_of_bar; i++){
		scanf("%lld %lld %lld %lld",&left,&right,&nodes[i].left_child,&nodes[i].right_child);
		if(left > right){
			common = getCommon(left,right);
		}else{
			common = getCommon(right,left);
		}

		nodes[i].p = left/common;
		nodes[i].q = right/common;
		nodes[i].left = 1;
		nodes[i].right = 1;

		nodes[nodes[i].left_child].parent = i;
		nodes[nodes[i].right_child].parent = i;
	}

	for(int i = 1; i <= num_of_bar;i++){
		if(nodes[i].parent == -1){
			root = i;
			break;
		}
	}

	calc(nodes,root);

	long long int ans = nodes[root].left + nodes[root].right;

	printf("%lld\n",ans);

}

int main(){

	int num_of_bar;

	while(true){
		scanf("%d",&num_of_bar);
		if(num_of_bar == 0)break;

		func(num_of_bar);

	}

	return 0;
}

Measured memory_bytes: 2716
fun main(args: Array<String>){
    readLine()
    //var N = inputs[0].toInt()
    var A = readLine()!!.split(" ").map(String::toInt)
    var B = readLine()!!.split(" ").map(String::toInt)
    var C = readLine()!!.split(" ").map(String::toInt)


    var satisfaction = 0
    for ((index, currentDish) in A.withIndex()) {
        satisfaction += B[currentDish - 1]
        
        if(index != 0) {
            var preDish = A[index-1]
            if(currentDish - preDish == 1)
                satisfaction += C[preDish - 1]
        }
    }

    println(satisfaction)
}

Measured memory_bytes: 36012
#include <iostream>
#include <vector>

using namespace std ;

void print1dvector(vector<int> v){
    for (int i=0 ; i<v.size() ; i++)
        cout << v[i] << " " ;
    cout << "\n" ;
}

void print2dvector(vector<vector<int> > v){
    for (int i=0 ; i<v.size() ; i++){
        for (int j=0 ; j<v[0].size() ; j++)
            cout << v[i][j] << " " ;
        cout << "\n" ;
    }
}

int main(){
    long long int num = 1000000007 ;
    int N, K ;
    cin >> N >> K ;
    
    vector<int> a(N) ;
    
    for (int i=0 ; i<N ; i++)
        cin >> a[i] ;
    
    vector<vector<int> > dp(K+1, vector<int>(N+1, 0)) ;
    
    for (int i=0 ; i<=N ; i++){
        dp[0][i] = 1 ;
    }
    
    for (int j=1 ; j<=N ; j++ ){
        vector<long long int> sum(K+1, 0) ;
        sum[0] = dp[0][j-1] ;
        
        for (int i=1 ; i<=K ; i++){
            sum[i] = sum[i-1] + dp[i][j-1] ;
        }
        
        for (int i=1 ; i<=K ; i++){
            int num_elements = min(i, a[j-1])+1 ;
            if (num_elements == i+1)
                dp[i][j] = sum[i]%num ;
            else
                dp[i][j] = (sum[i]-sum[i-num_elements])%num ;
        }
        
    }
    
    cout << dp[K][N] ;
    
    return 0 ;
}


Measured memory_bytes: 46588
n = int(input())
dp = [0, 0, 0] # last activity was A/B/C
for _ in range(n):
    ndp = [0] * 3
    d = list(map(int, input().split()))
    for i in range(3):
        ndp[i] = d[i] + max(dp[j] for j in range(3) if j != i)
    dp = ndp
print(max(dp))

Measured memory_bytes: 75156
#include<bits/stdc++.h>
using namespace std;
using ull=unsigned long long;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define setbits(x)  __builtin_popcount(x)
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;

//int divr[maxn];
/**/
/*void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
/*ll modexpo(ll a,ll b)
{
     ll ans=1LL;
     while(b>0)
     {
          if(b&1)ans=(ans*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return ans;
}
int find(int a){
     if(par[a]==a)return a;
     return par[a]=find(par[a]);
}
void unite(int a,int b){
     a=find(a),b=find(b);if(a==b)return ;
     parent[b]=a;
}*/
 
 
 
 
 
 
 









ll a[1005][3];
ll mx=0LL;
int main(){
    ll n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++){
         cin>>a[i][0]>>a[i][1]>>a[i][2];
    }
    for(int i=0;i<8;i++){
         vector<ll> vec;
         
         for(int j=1;j<=n;j++){
              ll s=0LL;
              for(int k=0;k<3;k++){
                   if((i/(1<<k))%2==0)s+=a[j][k];
                   else s-=a[j][k];
              }
              vec.pb(s);
         }
         sort(vec.rbegin(),vec.rend());
         ll res=0;
         for(int i=0;i<m;i++)res+=vec[i];
         mx=max(mx,res);

    }
    cout<<mx;
}

























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

int main()
{
	int n,a,b,t,x,sum=0;
	cin >> n >> a >> b;
	for(int i=1;i<=n;i++){
		t=0;
		x=i;
		while(x!=0){
			t += x%10;
			x = x/10;
		}
		if(t>=a&&t<=b) sum += i;
	}
	cout << sum << endl;
	return 0;
	
}

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

def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

N = num2alpha(N)
N_list = list(str(N))

n_arr = []
for str in N_list:
    n_arr.append(str.lower())
    
for i in n_arr:
    print(i, end="")

Measured memory_bytes: 9144
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 12 10:38:04 2019
D - Decayed Bridges
実行時間制限: 2 sec / メモリ制限: 1024 MB

配点 : 
400
 点
@author: justwah
"""

import sys
read = sys.stdin.readline

n, m = map(int, input().split())    # single line use regular input() is faster
score = n * (n-1) // 2

l = reversed([list(tuple(map(int, read().split()))) for i in range(m)])   #multiple lines use sys.stdin.readline faster

parent = [i for i in range(n+1)]
rank = [0]*(n+1)
size = [1]*(n+1)

def root(x): #recursively find root for a node
    if parent[x] == x: # if at root, return self
        return x
    else:
        parent[x] = root(parent[x])  # while searching rejoint queried node to a common parent for hierarchical tree
        return parent[x]
    
def merge(a, b):
    a = root(a)
    b = root(b)
    if rank[a] < rank[b]: # joint lower rank node to a higher rank one
        parent[a] = b
        size[b] += size[a]
    else:
        parent[b] = a
        size[a] += size[b]
        if rank[a] == rank[b]: # rank only change if two same rank node joined
            rank[a] +=1    
    return

ans = [score]
for a, b in l:
    a = root(a)
    b = root(b)
    if a != b:
        score -= size[a] * size[b]    
        merge(a, b)
        ans.append(score)
    else:
        ans.append(score)

print(*reversed(ans[:-1]))


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

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    int N = Integer.parseInt(in.readLine());
    int[] A = new int[N];
    StringTokenizer st = new StringTokenizer(in.readLine());
    for (int i = 0; i < N; ++i) {
      A[i] = Integer.parseInt(st.nextToken());
    }

    System.out.println(solve(N, A));

    in.close();
  }

  private static String solve(int N, int[] A) {
    boolean pc = true;
    Set<Integer> primes = factorize(A[0]);

    for (int i = 1; i < N && pc; ++i) {
      Set<Integer> factors = factorize(A[i]);
      for (int factor : factors) {
        if (primes.contains(factor)) {
          pc = false;
          break;
        }
      }
      primes.addAll(factors);
    }

    if (pc) {
      return "pairwise coprime";
    }

    long lastGcd = A[0];
    for (int i = 1; i < N; ++i) {
      lastGcd = gcd(lastGcd, A[i]); 
    }
    
    if (lastGcd == 1) {
      return "setwise coprime";
    }

    return "not coprime";
  }

  private static Set<Integer> factorize(int x) {
    Set<Integer> factors = new HashSet<>();
  
    int y = x;
    for (int i = 2; i * i <= y; ++i) {
      if (x % i == 0) {
        while (x % i == 0) {
          x /= i;
        }
        factors.add(i);
      } 
    }
    
    if (x > 1) {
      factors.add(x);
    }

    return factors;
  }

  private static long gcd(long a, long b) {
    if (b == 0) {
      return a;
    }

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

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


Measured memory_bytes: 2104
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
        checked {
#if DEBUG
            MyDebugger.Test(process, "../TextFile1.txt");
            //TestCaseMaker.MakeTestCase1("../TextFile2.txt");
            //MyDebugger.Test(process, "../TextFile2.txt");
#else
            object ret = process(new StreamReader(Console.OpenStandardInput()));
            //Console.WriteLine(ret);
#endif
        }
    }

    public const int QN = 26;
    static int n;
    static int[][] ss;
    static int[] cc;

    static object process(TextReader input) {
        n = int.Parse(input.ReadLine());
        cc = ToIntArray(input.ReadLine(), QN);

        ss = new int[n][];
        for (int i = 0; i < ss.Length; i++) {
            ss[i] = ToIntArray(input.ReadLine(), QN);
        }

        List<int> ans = new List<int>();
        for (int i=0; i<n; i++) {
            var x = int.Parse(input.ReadLine());
            ans.Add(x-1);
        }

        var m = int.Parse(input.ReadLine());
        for (int i=0; i < m; i++) {
            var spl = input.ReadLine().Split(' ');
            var di = int.Parse(spl[0]) - 1;
            var va = int.Parse(spl[1]) - 1;

            var prev = ans[di];
            ans[di] = va;
            
            var newscore = Score(ans, n);
            Console.WriteLine(newscore);
        }
        return null;
    }

    static long Score(List<int> ans, int day) {
        long y = 0;
        var lasts = new int[QN];

        for (int i=0; i<day; i++) {
            y += ss[i][ans[i]];
            lasts[ans[i]] = i+1;
            y -= DownVal(i+1, lasts);
        }
        return y;
    }

    static long UpVal(int day, int[] lasts, int si) {
        long up = ss[day-1][si];

        var prev = lasts[si];
        lasts[si] = day;
        var down = DownVal(day, lasts);
        lasts[si] = prev;
        
        return up - down;
    }

    static long DownVal(int day, int[] lasts) {
        long y = 0;
        for(int i=0; i < QN; i++) {
            y += cc[i] * (day - lasts[i]);
        }
        return y;
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        if (n == 0) return ret;
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 40632
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)

n=int(input())
a=[0]+list(map(int,input().split()))+[0]
#n=2
#a=[1000000000,1000000000]
#a=sorted(a)[::-1]
anslist=[]
L=[0 for i in range(n+2)]
R=[0 for i in range(n+2)]
for i in range(1,n+2):#メモ化
    L[i]=gcd(a[i],L[i-1])#0~iまでgcdを計算したものをメモ
    R[n+1-i]=gcd(a[n+1-i],R[n+2-i])#n+2~iまでを計算したものをメモ
for i in range(1,n+1):
    anslist.append(gcd(L[i-1],R[i+1]))
print(max(anslist))

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

int main() {
  int i=0,j,k;
  int A,B;
  int ans=0;
  
  cin >> A >> B ;

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

  cout << ans <<endl;
  
  
  return 0;
}

Measured memory_bytes: 256
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


# SegTreeの関数
def segfunc(x, y):
    return x | y
# 単位元
# min->inf, max->-inf, add->0, mul->1
ide_ele = set()

# セグメント木
class SegTree:
    """
    init(init_val, segfunc, ide_ele): 配列init_valで初期化、構築
    update(k, x): k番目の値をxに更新
    query(l, r): 区間[l, r)をsegfuncしたものを返す
    """
    def __init__(self, init_val, segfunc, ide_ele):
        n = len(init_val)
        self.segfunc = segfunc
        self.ide_ele = ide_ele
        self.num = 1 << (n-1).bit_length()
        self.tree = [ide_ele] * 2 * self.num
        # 配列の値を葉にセットする
        for i in range(n):
            self.tree[self.num + i] = init_val[i]
        # 構築
        for i in range(self.num - 1, 0, -1):
            self.tree[i] = self.segfunc(self.tree[2*i], self.tree[2*i+1])

    def update(self, k, x):
        """
        k番目の値をxに更新
        :param k: index(0-index)
        :param x: update value
        """
        k += self.num
        self.tree[k] = x
        while k > 1:
            self.tree[k>>1] = self.segfunc(self.tree[k], self.tree[k ^ 1])
            k >>= 1

    def query(self, l, r):
        """
        [l, r)のsegfuncしたものを得る
        :param l: 0-index
        :param r: 0-index
        :return:
        """
        res = self.ide_ele
        l += self.num
        r += self.num
        while l < r:
            if l & 1:
                res = self.segfunc(res, self.tree[l])
                l += 1
            if r & 1:
                res = self.segfunc(res, self.tree[r-1])
            l >>= 1
            r >>= 1
        return res


def main():
    N = NI()
    S = SI()
    Q = NI()
    querys = [list(SI().split()) for _ in range(Q)]
    S_sets = []
    for s in S:
        tmp = set()
        tmp.add(s)
        S_sets.append(tmp)

    segtree = SegTree(S_sets, segfunc, ide_ele)

    for query in querys:
        if query[0] == "1":
            segtree.update(int(query[1]) - 1, {query[2]})
        else:
            l, r = int(query[1])-1, int(query[2])
            print(len(segtree.query(l, r)))



if __name__ == "__main__":
    main()

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

int main(){

  int a,b,c,d,e;
  int A=9,B=9,C=9,D=9,E=9, ans;
  cin >> a >> b >> c >> d >> e;

  if((a%10)!=0) A = (a%10);
  if((b%10)!=0) B = (b%10);
  if((c%10)!=0) C = (c%10);
  if((d%10)!=0) D = (d%10);
  if((e%10)!=0) E = (e%10);

  int T = min(A, B);
  T = min(T, C);
  T = min(T, D);
  T = min(T, E);

  if((a%10)==0 && (b%10)==0 && (c%10)==0 && (d%10)==0 && (e%10)==0) T=10;

  if((a%10)!=0) a += (10-a%10);
  if((b%10)!=0) b += (10-b%10);
  if((c%10)!=0) c += (10-c%10);
  if((d%10)!=0) d += (10-d%10);
  if((e%10)!=0) e += (10-e%10);

  cout << a+b+c+d+e-10+T << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

typedef long long llong;
typedef unsigned long long ullong;

#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

//????????±?????¨??????
int lcs(string X, string Y) {
	static const int MAX_X = 1, MAX_Y = 1;
	static int dp[MAX_X + 1][MAX_Y + 1];
	memset(dp, 0, sizeof(dp));
	for (int i = 1; i <= X.size(); i++) {
		for (int j = 1; j <= Y.size(); j++) {
			if (X[i - 1] == Y[j - 1]) {
				dp[i][j] = dp[i - 1][j - 1] + 1;
			}
			else {
				dp[i][j] = max(
					dp[i - 1][j],
					dp[i][j - 1]
				);
			}
		}
	}
	return dp[X.size()][Y.size()];
}

//???????¢??????¨??????
int lis(int A[]) {
	static const int MAX_N = 100000;
	static int a[MAX_N];
	memset(a, 0x3f, sizeof(a));
	for (int i = 0; i < MAX_N; i++) {
		*lower_bound(a, a + MAX_N, A[i]) = A[i];
	}
	return find(a, a + MAX_N, INF) - a;
}

int main() {
	int A[100000] = {};
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		scanf("%d", &A[i]);
	}
	cout << lis(A) << endl;
	return 0;
}

Measured memory_bytes: 2028
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <functional>
#include <limits>
#include <queue>
#include <iomanip>
#include <deque>
#include <stack>
#include <cstdio>
#include <cmath>
#include <complex.h>
#include <cstdio>
#include <random>
#include <chrono>
#include <numeric>
#include <cassert>
#include <iso646.h>
#include <exception>
#include <stdexcept>

using namespace std;

typedef long long i64;

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


    string s;
    cin >> s;

    int cnt = 0;
    for (char c : s)
        cnt += c == '1';

    cout << cnt;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAXS 10000
#define MAXT 500

int search(int *A, int n, int key);

int main(){

  int i,j,k,n,q;

  int cnt=0;

  scanf("%d",&n);

  int S[n];

  for(i=0;i<n;i++){
    
    scanf("%d", &S[i]);

  }

  scanf("%d", &q);

  int T[q];

  for(i=0;i<q;i++){

    scanf("%d", &T[i]);

  }

  /* 

  printf("%d\n", n);

  for(i=0;i<n;i++){
    
    printf("%d", S[i]);

  }

  
  printf("\n", n);
  
  printf("%d\n", q);

  for(i=0;i<q;i++){
    
    printf("%d",T[i]);

  }

  printf("\n", n);

  */

  for(i=0; i<q; i++){

    if(search(S, n, T[i])){

      cnt++;

    }

  }
			     
  printf("%d\n",cnt);
  
  return 0;
  
}

int search(int *A, int n, int key){

  int i=0;

  A[n]=key;

  while(A[i]!=key){

    i++;

  }

  return i!=n;

}



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

int main(){
    string key="keyence";
    string s; cin >> s;

    
    // 前半一致数
    int mae=0;
    while(s[mae]==key[mae]){
        mae++;
    }

    // 後半一致
    int usiro=0;
    while(s[s.size()-1 - usiro] == key[key.size() -1 -usiro]){
        usiro++;
    }


    if(mae + usiro >=key.size()){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 3620
#include <stdio.h>

int main() {
	long long K, a[100100], i, n, m, nn, mm, w = 0;
	for (scanf("%lld", &K), i = 0; i != K; i++)
		scanf("%lld", &a[i]);
	for (a[K-1] == 2 && w++, i = K-2, n = nn = 2, m = 3; w && i >= 0; i--)
		n%a[i] && (nn = (n/a[i]+1)*a[i]), m%a[i] ? (mm = m/a[i]*a[i]+a[i]-1) : (mm = m+a[i]-1), nn/a[i]*a[i] <= m && mm/a[i]*a[i] <= m ? (n = nn, m = mm) : w--;
	w ? printf("%lld %lld\n", n, m) : puts("-1");
}

Measured memory_bytes: 896
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		try (Scanner sc = new Scanner(System.in)) {
			int x = sc.nextInt();
			int a = sc.nextInt();
			int b = sc.nextInt();
			
			int count = (x - a) / b;
			int result = x - a - b * count;
			System.out.println(result);
		}

	}

}

Measured memory_bytes: 20688
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 1000000000000000
#define endl '\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;

int V;
int a[310][310];

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>V;
    int ans=0;
    rep(i,V)rep(j,V)cin>>a[i][j];
    rep(i,V)rep(j,V){
        bool b=true;
        rep(k,V){
            if(a[i][j]>a[i][k]+a[k][j]){
                cout<<-1<<endl;
                return 0;
            }else if(a[i][j]==a[i][k]+a[k][j]){
                if(i!=k and j!=k)b=false;
            }
        }
        if(b){
            ans+=a[i][j];
        }
    }
    cout<<ans/2<<endl;
}

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

int main() {
  int a;
  string s, str;

  cin >> a;
  cin >> s;

  if(s.size() <= a){
      cout << s << endl;
  }else{
      for(int i = 0; i < a; i++){
          str = str + s[i];
      }
      cout << str << "..." << endl;
  }

}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define vb vector<bool>
#define vi vector<ll>
#define vs vector<string>
#define vvi vector<vi>
#define vii vector<pair<ll, ll>>
#define pii pair<ll, ll>
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(a) (a).begin(), (a).end()
#define INF 1000*1000*1000
#define mod (INF + 7)
#define mod1 (mod-1)
#define endl '\n'
#define fio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
using namespace std;

vb vis;
ll ans = INT_MAX, d, g;

void solve(ll i, vii &arr, ll s, ll g1)
{
    vis[i-1] = true;
    int p, b;
    tie(p, b) = arr[i-1];

    int ps = g1/(100*i);

    if(p*100*i + b >= g1)
    {
        vis[i-1] = false;
        if(ps <= p)
            ans = min(ans, s+ps);
        else
            ans = min(ans, s+p);
        return;
    }

    g1 -= p*100*i+b;
    s += p;

    for(int i = 0; i < d; i++)
        if(!vis[i])
            solve(i+1, arr, s, g1);
    vis[i-1] = false;
}

int main()
{
    cin >> d >> g;

    vis.resize(d);
    fill(all(vis), false);

    vii arr(d);
    for(int i = 0; i < d; i++)
        cin >> arr[i].f >> arr[i].s;

    for(int i = 0; i < d; i++)
        solve(i+1, arr, 0, g);

    if(ans == 0)
        ans = 1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc145/tasks/abc145_f

#include "algorithm"
#include "functional"
#include "iostream"
#include "numeric"
#include "queue"
#include "set"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define fi first
#define se second
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll N, K;
  cin >> N >> K;
  VL hs(N + 1);
  hs[0] = 0;
  rep(i, N) cin >> hs[i + 1];

  // dp[i][j]: 最も右の項が hs[i] 番目で合計 j 本消した場合のコストの最小値
  VVL dp(N + 1, VL(K + 1, INF));
  dp[0][0] = 0;

  repf(i, 1, N + 1) {
    rep(j, i) {
      ll to_be_removed = i - j - 1;
      rep(k, K - to_be_removed + 1) {
        chmin(dp[i][k + to_be_removed], dp[j][k] + max(0ll, hs[i] - hs[j]));
      }
    }
  }

  ll res = INF;
  rep(i, K + 1) chmin(res, dp[N - i][K - i]);
  cout << res << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

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

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

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<functional>
#include<vector>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
  int N,M;
  cin>>N>>M;
  char table[N][M];
  rep(i,N){
    rep(j,M){
      cin>>table[i][j];
    }
  }
  rep(i,N){
    rep(j,M){
      if(table[i][j]=='#') continue;
      int cnt=0;
      if(i-1>=0&&j-1>=0){
        if(table[i-1][j-1]=='#') cnt++;
      }
      if(i-1>=0&&j>=0){
        if(table[i-1][j]=='#') cnt++;
      }
      if(i-1>=0&&j+1<M){
         if(table[i-1][j+1]=='#') cnt++;
      }
      if(i>=0&&j-1>=0){
        if(table[i][j-1]=='#') cnt++;
      }
      if(i>=0&&j+1<M){
        if(table[i][j+1]=='#') cnt++;
      }
      if(i+1<N&&j-1>=0){
        if(table[i+1][j-1]=='#') cnt++;
      }
      if(i+1<N&&j>=0){
        if(table[i+1][j]=='#') cnt++;
      }
      if(i+1<N&&j+1<M){
        if(table[i+1][j+1]=='#') cnt++;
      }
      table[i][j]=cnt+'0';
    }
  }
  rep(i,N){
    rep(j,M){
      cout<<table[i][j];
    }
    cout<<endl;
  }
}

Measured memory_bytes: 3592
n=gets.to_i
hS = gets.split.map(&:to_i)
nowCount=0
maxCount=0
(0...(n-1)).each do |index|
  if hS[index] >= hS[index+1]
    nowCount+=1
  else
    nowCount = 0
  end
  maxCount = nowCount if nowCount > maxCount
end
puts maxCount

Measured memory_bytes: 8580
// khodaya khodet komak kon
#include <bits/stdc++.h>
#define pb push_back
#define ers erase
#define ins insert
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
#define kill(x) return cout << x, 0;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<pll> vpl;

const ld Pi = 3.14159265359;
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll N = 2e5 + 10;
const ll INF = 1e18;
const ll LOG = 20;

int main(){
	IOS;
	ll a, b;
	cin >> a >> b;
	if (abs(a - b) <= 1) kill("Brown");
	kill("Alice");	
	
	
	
	
	
	
	
	return 0;
}






/*
     ,---,           ___                 ,--,
    '  .' \        ,--.'|_             ,--.'|                             ,--,
   /  ;    '.      |  | :,'            |  | :                           ,--.'|    ,---.        ,---,
  :  :       \     :  : ' :            :  : '                 .--.--.   |  |,    '   ,'\   ,-+-. /  |
  :  |   /\   \  .;__,'  /    ,--.--.  |  ' |     ,--.--.    /  /    '  `--'_   /   /   | ,--.'|'   |
  |  :  ' ;.   : |  |   |    /       \ '  | |    /       \  |  :  /`./  ,' ,'| .   ; ,. :|   |  ,"' |
  |  |  ;/  \   \:__,'| :   .--.  .-. ||  | :   .--.  .-. | |  :  ;_    '  | | '   | |: :|   | /  | |
  '  :  | \  \ ,'  '  : |__  \__\/: . .'  : |__  \__\/: . .  \  \    `. |  | : '   | .; :|   | |  | |
  |  |  '  '--'    |  | '.'| ," .--.; ||  | '.'| ," .--.; |   `----.   \'  : |_|   :    ||   | |  |/
  |  :  :          ;  :    ;/  /  ,.  |;  :    ;/  /  ,.  |  /  /`--'  /|  | '.'\   \  / |   | |--'
  |  | ,'          |  ,   /;  :   .'   \  ,   /;  :   .'   \'--'.     / ;  :    ;`----'  |   |/
  `--''             ---`-' |  ,     .-./---`-' |  ,     .-./  `--'---'  |  ,   /         '---'
                            `--`---'            `--`---'                 ---`-'
*/




Measured memory_bytes: 256
from itertools import *
from bisect import *
from math import *
from collections import *
from heapq import *
from random import *
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def MF(): return map(float, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LF(): return list(map(float, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]

def main():
    x,y,z,n,m,s,t=MI()
    s,t=s-1,t-1+n
    itoab=[]
    to1=defaultdict(list)
    to2=defaultdict(list)
    for i in range(n):
        a,b=MI1()
        itoab.append([a,b])
        to1[a].append(i)
        to2[b].append(i)
    for i in range(n,n+m):
        b,a=MI1()
        a+=x
        itoab.append([a,b])
        to1[a].append(i)
        to2[b].append(i)
    dist=[-1]*(n+m)
    hp=[]
    heappush(hp,[0,s])
    while hp:
        d,i=heappop(hp)
        if dist[i]!=-1:continue
        dist[i]=d
        a,b=itoab[i]
        for j in to1[a]:
            if j==t:
                print(d+1)
                exit()
            if j==i:continue
            if dist[j]!=-1:continue
            heappush(hp,[d+1,j])
        for j in to2[b]:
            if j==t:
                print(d+1)
                exit()
            if j==i:continue
            if dist[j]!=-1:continue
            heappush(hp,[d+1,j])
    print(-1)

main()



Measured memory_bytes: 84488
#include<cstring>
#include<iostream>
#include<cstdio>
using namespace std;
string a,b;
int main()
{
    cin>>a;
    for(int s=1;s<a.size();s++)
    {
        if(a[s]==a[s-1])
        {
            cout<<s<<" "<<s+1<<endl;
            return 0;
        }
    }
    for(int s=2;s<a.size();s++)
    {
        if(a[s]==a[s-2])
        {
            cout<<s-1<<" "<<s+1<<endl;
            return 0;
        }
    }
    cout<<-1<<" "<<-1<<endl;
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
	
	int t=1;
	while(t--){
		int n;
		cin>>n;
		int a[n][3];
		int pre[3];
		int cur[3];
		
		for(int i=0;i<n;i++)
			cin>>a[i][0]>>a[i][1]>>a[i][2];
		pre[0]=a[0][0];
		pre[1]=a[0][1];
		pre[2]=a[0][2];

		for(int i=1;i<n;i++){
			cur[0]=a[i][0]+max(pre[1],pre[2]);
			cur[1]=a[i][1]+max(pre[0],pre[2]);
			cur[2]=a[i][2]+max(pre[0],pre[1]);
			
			pre[0]=cur[0];
			pre[1]=cur[1];
			pre[2]=cur[2];

		}

		cout<<max(pre[0],max(pre[1],pre[2]))<<endl;
		

	}
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


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

  if(N == M) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main{
	public static void main(String[] args){
		InputStreamReader ir = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(ir);

		String str = null;
		try{
			str = br.readLine();
		}catch(IOException ex){
			ex.printStackTrace();
		}

		String[] input = str.split(" ");
		int a = Integer.parseInt(input[0]);
		int b = Integer.parseInt(input[1]);
		int k = Integer.parseInt(input[2]);

		List<Integer> res = new ArrayList<>();
		for(int i = 1; i <= 100; i++){
			if(a % i == 0 && b % i == 0){
				res.add(i);
			}
		}
		System.out.println(res.get(res.size() - k));
	}
}


Measured memory_bytes: 21460
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
using namespace std;
 
//conversion
//------------------------------------------
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();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 
 
int main(){
  LL N,C,K;
  cin >> N >> C >> K;
  LL T[N];
  REP(i,N) cin >> T[i];
  pair<LL,LL>p[N];
  REP(i,N) p[i]={T[i],i};
  sort(T,T+N);
  LL count=0;
  int pos=0;
  LL num_min=0;
  LL ans=0;
  while(pos<N){
    num_min=T[pos];
    ++ans;
    while(count!=C && pos+count<N){
      if(T[pos+count]>=num_min && T[pos+count]<=num_min+K){
        ++count;
      }
      else{
        break;
      }
    }
    pos+=count;
    count=0;
    }
    cout << ans;
  }

Measured memory_bytes: 2560
use std::io::Read;

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    let mut buf = String::new();
    let stdin = std::io::stdin();
    stdin.lock().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();

    let n = iter.next().unwrap().parse::<usize>().unwrap();
    let m = iter.next().unwrap().parse::<usize>().unwrap();

    let mut a = vec![0; m];
    let mut x = vec![0; m];
    for i in 0..m {
        a[i] = iter.next().unwrap().parse::<usize>().unwrap();
        let bi = iter.next().unwrap().parse::<usize>().unwrap();
        for _ in 0..bi {
            let cij = iter.next().unwrap().parse::<usize>().unwrap();
            x[i] |= 1 << (cij - 1);
        }
    }
    // println!("{:?}", x);

    let inf = 10000000000;
    let max = 2usize.pow(n as u32);
    let mut dp = vec![inf; max];
    dp[0] = 0;

    for i in 0..m {
        for j in 0..max {
            let y = x[i] | j;
            let s = dp[j] + a[i];
            if s < dp[y] {
                dp[y] = s;
            }
        }
    }
    if dp[max - 1] == inf {
        println!("-1");
    } else {
        println!("{}", dp[max - 1]);
    }
}


Measured memory_bytes: 4352