akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<time.h>
#include<string>
#include<cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<stack>
#include<set>
#include <limits>
#include <climits>
#include <numeric>
#include<cassert>
#include<cctype>
#include<iterator>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef vector<ll>VI;
typedef vector<bool>VB;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define bitrep(bit,A) for(int bit=A; ;bit=(bit-1)&A)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) (ll)((a).size())
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=c_max(x,a)
#define chmin(x,a) x=c_min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define SORT(c) stable_sort(ALL(c))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
const int MOD = 1000000007;
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
#define greater greater<int>()
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
using Edge=pair<int,ll>;
using Graph=vector<vector<ll> >;//ll or Edge
using Edge=pair<int,ll>;
//const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// g++ -o a a.cpp -Wall -lm -std=c++14

vector<ll> n_system(ll n,ll num,ll digit=0){
    vector<ll>ans;
    while(num){
        ll t=num%n;
        if(t==0){t=26;ans.push_back(t);num-=26;num/=n;continue;}
        ans.push_back(t);
        num/=n;
    }
    ll x=digit-ans.size();
    if(x>0){
        vector<ll>list(x,0);
        ans.insert(ans.end(),list.begin(),list.end());
    }
    std::reverse(ans.begin(),ans.end());
    return ans;
}
int main(){
    ll a;cin>>a;
    ll x=26;
    VI ans=n_system(x,a);
    string s="";
    rep(i,ans.size()){
      s+=(ans[i]+'a'-1);
    }
    cout<<s<<endl;
}

Measured memory_bytes: 3552
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)*}
    };
}
 
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)*}
    };
}
 
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, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
/*106
*/
    fn judge(n:i32)->i32{
        let mut ans=0;
        for i in 1..n+1{
            if n%i==0{
                ans+=1;
            }
        }
        ans
    }
    input!{n:i32}
    let mut ans=0;
    for i in 1..n+1{
        if judge(i)==8  && i%2==1{ans+=1;}
    }
    println!("{}", ans);


}


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

#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
typedef long long ll;
////////////////////////////////////////////////////////////

const int size = 100010LL;
long long dp[size][13];
int main(){
	string s;
	cin >> s;

	int n = s.size();


	dp[0][0] = 1;

	for(int i = 0; i < n ; i++ ){
		int c;
		if( s[i] == '?' ) c = -1;
		else c = s[i] - '0';

		for( int j = 0 ; j < 10 ; j++ ){
			if( c != -1 && c != j ) continue;
			for( int k = 0 ; k < 13 ; k++ )
				dp[ i + 1 ][ ( k * 10 + j ) % 13 ] += dp[i][k];
		}

		for( int j = 0 ; j < 13 ; j++ )
			dp[i+1][j] %= mod;

	}

	/*

	for( int i = 0  ; i < n ; i++ ){
		for( int j = 0 ; j < 13 ; j++ ){
			printf("%.5lld\t" , dp[i][j]);
		}
		cout << endl;
	}
	*/

	cout << dp[n][5] << endl;

	ret 0;
}

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

int main(){
  int a,b;
  cin >> a >> b;
  if((a+b)%2 == 1) {
    cout << (a+b)/2+1 << endl;
  }
  else {
    cout << (a+b)/2 << endl;
  }
}


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

public class Main{

    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        Card[] cards = new Card[n];
        for(int i = 0; i < n; i++){
            cards[i] = new Card(i);
        }
        //String[] in = br.readLine().split(" ");                                           
        //System.out.println("debug");                                                      
        for(int i = 0; i < n; i++){
            String[] in = br.readLine().split(" ");
            //cards[i] = new Card(i);                                                       
            cards[i].picture = in[0];
            cards[i].value = Integer.parseInt(in[1]);
        }

        quickSort(cards, 0, n - 1);

        StringBuilder sb = new StringBuilder();
        if(isStable(cards, n)) sb.append("Stable\n");
        else sb.append("Not stable\n");

        for(int i = 0; i < n; i++){
            sb.append(cards[i].picture).append(" ").append(cards[i].value).append("\n");
        }

        System.out.print(sb);

    }

    public static void quickSort(Card[] cards, int p, int r){
        if(p < r){
            int q = partition(cards, p, r);
            quickSort(cards, p, q - 1);
            quickSort(cards, q + 1, r);
        }
    }

    public static int partition(Card[] cards, int p, int r){
        int x = cards[r].value;
        int i = p - 1;
        Card temp = new Card(0);
        for(int j = p; j < r; j++){
            if(cards[j].value <=  x){
                i = i + 1;
                temp = cards[i];
                cards[i] = cards[j];
                cards[j] = temp;
            }
        }
        temp = cards[i+1];
        cards[i+1] = cards[r];
        cards[r] = temp;
        return i + 1;
    }

    public static boolean isStable(Card[] cards, int n){
        for(int i = 0; i < n - 1; i++){
            if(cards[i].value == cards[i+1].value){
                if(cards[i].numForStable > cards[i+1].numForStable)return false;
            }
        }
        return true;
    }

}

class Card{
    String picture;
    int value;
    int numForStable;
    Card(int i){
        this.numForStable = i;
    }
}

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

int main()
{
 int A,B,C;
  cin>>A>>B>>C;
  bool check=0;
  if(A==B&&A!=C)check=1;
  else if(B==C&&A!=B)check=1;
  else if(A==C&&A!=B)check=1;
  
  
  if(check==1){cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <numeric>

static const int INF = 1000000007;
using ll = long long;
using namespace std;

int main() {
    int n, a, b, ans = 0;
    cin >> n >> a >> b;
    for (int i = 1; i <= n; ++i) {
        string w = to_string(i);
        int k = 0;
        for (auto &c : w) {
            k += c - '0';
        }
        if (a <= k && k <= b){
            ans+=i;
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include <cassert>

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

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);

    int64_t sum = 0;
    int64_t evensum = 0;
    rep(i, N) {
        cin >> A[i];
        sum += A[i];
        if(i%2 == 1) {
            evensum += A[i];
        }
    }

    vector<int64_t> X(N+1);
    X[0] = sum - (evensum*2);

    rep(i, N) {
        X[i+1] = A[i] * 2 - X[i];
    }

    rep(i, N) {
        cout << X[i] << " ";
    }
    cout << endl;

    return 0;
}



Measured memory_bytes: 3820
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP2(i, s, n) for(int i=s;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
#define bitSearch(bit, n) for(int bit = 0; bit < (1 << N); bit++)
using namespace std;
typedef long long ll;
typedef unsigned long ul;
typedef long double ld;


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

ll inf = 10000000;
ll mod = 1000000007;

int main() {
    int N, D;
    cin >> N >> D;
    int X[15][15];
    REP(i, N) {
        REP(j, D) {
            cin >> X[i][j];
        }
    }

    int ans = 0;

    REP(i, N - 1) {
        REP2(j, i + 1, N) {
            int dis = 0;
            bool sq = false;
            REP(k, D) {
                dis += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
            }
            REP(l, dis + 1) {
                if (l * l == dis) {
                    sq = true;
                    break;
                }
                if (l * l > dis) { break; }
            }
            if (sq) { ans += 1; }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
/* monkukui 競技プログラミング用のテンプレート  (ここから) */
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
using ll = long long int;
using lnt = long long int;
using Graph = vector<vector<int>>;
using Wgraph = vector<vector<pair<int, long long int>>>;
constexpr long long int INF = 1001001001001001LL;
constexpr long long int MOD = 1000000007LL;
constexpr double PI = 3.1415926535897932;
constexpr long long int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
constexpr long long int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
inline void yes(){ cout << "yes" << endl; }
inline void Yes(){ cout << "Yes" << endl; }
inline void YES(){ cout << "YES" << endl; }
inline void no(){ cout << "no" << endl; }
inline void No(){ cout << "No" << endl; }
inline void NO(){ cout << "NO" << endl; }
inline void possible(){ cout << "possible" << endl; }
inline void Possible(){ cout << "Possible" << endl; }
inline void POSSIBLE(){ cout << "POSSIBLE" << endl; }
inline void impossible(){ cout << "impossible" << endl; }
inline void Impossible(){ cout << "Impossible" << endl; }
inline void IMPOSSIBLE(){ cout << "IMPOSSIBLE" << endl; }

#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = 1; i <= (n); i++)
#define DREP(i,n) for(int i = (n)-1; i >= 0; i--)
#define SREP(i,s,t) for(int i = s; i < t; i++)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define PB push_back

/* monkukui 競技プログラミング用のテンプレート (ここまで)*/

int main(){
 
  int n; cin >> n;
  vector<int> d(n);
  for(int i = 0; i < n; i++) cin >> d[i];
  int ans = 0;
  for(int i = 0; i < n; i++) for(int j = i + 1; j < n; j++) ans += d[i] * d[j];
  cout << ans << endl; 
  return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>

using namespace std;

int main()
{
  vector<int> num;
  int i, x;
  for (i = 0; i < 5; i++) {
    cin >> x;
		num.push_back(x);
  }

  sort(num.begin(), num.end(), greater<int>());

  for (i = 0; i < 5; i++) {
		if (i == 4) {
      cout << num[i] << endl;
			break;
    }
    cout << num[i] << " ";
  }

  return 0;
}

Measured memory_bytes: 1216
// Example program
#include <iostream>
#include <string>

using namespace std;
int main() {
    int N; // age input
    int a, b;
    cin >> N >> a >> b;
    if (N==1){
        cout << "Hello World";
        
    } else if (N==2){
        cout << a+b;
    }
    return 0;
 
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    for(int i = 0; i < H; i++) cin >> S[i];
    
    ll d[H*W][H*W];
    for(int h = 0; h < H*W; h++){
        for(int w = 0; w < H*W; w++){
            if(h == w) d[h][w] = 0;
            else d[h][w] = inf;
        }
    }
    
    for(int h = 1; h < H; h++){
        for(int w = 0; w < W; w++){
            //cout << S[h - 1][w] << " " << S[h][w] << "\n";
            if(S[h - 1][w] == '.' && S[h][w] == '.'){
                //cout << h - 1 << " " << w << " " << w + (h - 1)*W << " " << w + h*W << "\n";
                d[w + (h - 1)*W][w + h*W] = 1;
                d[w + h*W][w + (h - 1)*W] = 1;
            }
        }
    }
    
    for(int h = 0; h < H; h++){
        for(int w = 1; w < W; w++){
            if(S[h][w - 1] == '.' && S[h][w] == '.'){
                //cout << h << " " << w - 1 << " " << w - 1 + h*W << " " << w + h*W << "\n";
                d[w - 1 + h*W][w + h*W] = 1;
                d[w + h*W][w - 1 + h*W] = 1;
            }
        }
    }
    
    /**
    for(int h = 0; h < H*W; h++){
        for(int w = 0; w < H*W; w++){
            cout << setw(10) << d[h][w] << " ";
        }
        cout << "\n";
    }
    **/
    
    for (int k = 0; k < H*W; k++){       // 経由する頂点
        for (int i = 0; i < H*W; i++) {    // 始点
            for (int j = 0; j < H*W; j++) {  // 終点
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
    
    ll ans = 0;
    for(int h = 0; h < H*W; h++){
        for(int w = 0; w < H*W; w++){
            if(d[h][w] != inf) ans = max(ans, d[h][w]);
            //cout << setw(10) << d[h][w] << " ";
        }
        //cout << "\n";
    }
    
    cout << ans << "\n";
    return 0;
}


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

int N;
bool ada = false;

int main () {
    cin >> N;
    for (int i=1; i<=9; i++) {
        for(int j=1; j<=9; j++) {
            if (i*j == N) {
                ada = true;
            }
        }
    }
if(ada){
    cout << "Yes" << endl;
}else{
    cout << "No" << endl;
    }   
}

Measured memory_bytes: 3624
N,M = map(int,input().split())
X = list(map(int,input().split()))

X.sort()
ans = X[-1] - X[0]
D = []

for i in range(M-1):
  D += [X[i+1] - X[i]]
D.sort(reverse=True) 
if N >= M:
  print(0)
  exit()

for i in range(N-1):
  ans -= D[i]
print(ans)

Measured memory_bytes: 57128
#include <vector>
#include <string>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <sstream>
#include <map>
#include <iomanip>
using namespace std;

typedef long long ll;

int main()
{
	int A, B, Q;
	cin >> A >> B >> Q;
	vector<ll>s(A);
	vector<ll>t(B);
	for (int i = 0; i < A; i++)
		cin >> s[i];
	for (int i = 0; i < B; i++)
		cin >> t[i];
	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	while (Q--)
	{
		ll ans = 1e15;
		ll x;
		cin >> x;
		
		auto it1 = lower_bound(s.begin(), s.end(), x);
		if (it1 == s.end()) {
			it1--;
			
			
		}
		
		auto cpy1 = it1;
		auto it2 = lower_bound(t.begin(), t.end(), x);
		if (it2 == t.end())it2--;
		auto cpy2 = it2;
		if (it1 != s.begin())--cpy1;
		if (it2 != t.begin())--cpy2;
		ans = min(ans, abs(*it1 - *it2) + min(abs(x - *it1), abs(x - *it2)));
		ans = min(ans, abs(*it1 - *cpy2) + min(abs(x - *it1), abs(x - *cpy2)));
		ans = min(ans, abs(*cpy1 - *it2) + min(abs(x - *cpy1), abs(x - *it2)));
		ans = min(ans, abs(*cpy1 - *cpy2) + min(abs(x - *cpy1), abs(x - *cpy2)));
		cout << ans << '\n';
	}

}

Measured memory_bytes: 2944
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

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

	public static void ALDS1_6_B() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] A = new int[n];
		for(int i = 0; i < n; i++)
			A[i] = sc.nextInt();
		
		int x = A[n-1];
		int j = -1;
		for(int i = 0; i < n - 1; i++) {
			if(A[i] <= x) {
				j++;
				int tmp = A[j];
				A[j] = A[i];
				A[i] = tmp;
			}
		}
		int tmp = A[j + 1];
		A[j + 1] = A[n - 1];
		A[n - 1] = tmp;

		for(int i = 0; i < n; i++) {
			if(i != 0)
				System.out.print(" ");
			if(i == j + 1)
				System.out.print("[");
			System.out.print(A[i]);
			if(i == j + 1)
				System.out.print("]");
		}
		System.out.println();
	}
}


Measured memory_bytes: 67956
#include <iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
ll s1, s2, c1, c2;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll n, a;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a;
		s1 += a;
		s2 += a;
		if (i % 2) {
			if (s1 <= 0) c1 += 1 - s1,s1 = 1;
			if (s2 >= 0) c2 += 1 + s2,s2 = -1;
		}
		else {
			if (s1 >= 0) c1 += 1 + s1,s1 = -1;
			if (s2 <= 0) c2 += 1 - s2,s2 = 1;
		}
	}
	cout << min(c1, c2) << endl;
	return 0;
}

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

int main(){
    int n;
    int count = 0;
    string s;
    cin >> n;
    cin >> s;
    for(int i=0;i<n-2;i++){
        if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')count++;
    }
    cout << count << endl;
}

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

int item_w[1001];
int item_p[1001];
int n;
int w;
int dp[1002][1001];
int main()
{
  int casenum = 1;
  for(;cin>>w,w;)
    {
      cin>>n;
      memset(dp,-1,sizeof(dp));
      for(int i=0;i<n;i++)
	{
	  char tmp;
	  cin>>item_p[i]>>tmp>>item_w[i];
	}
      int wa=0;
      int ans=0;
      dp[0][0]=0;
      for(int i=0;i<=n;i++)
	{
	  for(int j=0;j<=w;j++)
	    {
	      if(dp[i][j]!=-1)
		{
		  dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
		  if(j+item_w[i]<=w)
		    dp[i+1][j+item_w[i]]=max(dp[i+1][j+item_w[i]],dp[i][j]+item_p[i]);
		}
	    }
	}
	  for(int j=0;j<=w;j++)
	    {
	      if(ans<dp[n][j])
		{
		  ans=dp[n][j];
		  wa=j;
		}
	    }
	    cout<<"Case "<<casenum++<<":"<<endl<<ans<<endl<<wa<<endl;
    }
}

Measured memory_bytes: 5096
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  int m;
  int a[101];
  int b[101];
  int data[101]={0};
  int count=0;
  cin>>n;
  cin>>m;
  for(int i=0;i<m;i++){
    cin>>a[i];
  }
   
  for(int i=0;i<m;i++){
    count=0;
    for(int j=0;j<n;j++){
      cin>>b[j];
      if(b[j]==a[i]){
    data[j+1]++;
      }else{
    count++;
      }
    }
    data[a[i]]+=count;
  }
  for(int i=1;i<=n;i++){
    cout<<data[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1164
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int k;
ll a[100100];

void solve() {
    if (a[k-1] != 2) {
        cout << -1 << endl;
        return;
    }
    if (k == 1) {
        cout << "2 3" << endl;
        return;
    }
    
    ll l = 2, h = 3;
    for (int i = k-2; i >= 0; i--) {
        ll s = ((l + a[i] - 1) / a[i]) * a[i];
        ll t = (h / a[i]) * a[i];
        if (s < l || h < s || t < l || h < t) {
            cout << "-1" << endl;
            return;
        }
        l = s;
        h = t + a[i] - 1;
    }
    cout << l << " " << h << endl;
}

void input() {
    cin >> k;
    for (int i = 0; i < k; i++) cin >> a[i];
}

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

    input();
    solve();
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main()
{
    // 整数の入力
    int n;
    int count = 0;
    int a[20];
    cin >> n;
    for(int i=0;i<n;i++){
      cin >> a[i];
    }
    for(int i=1;i<n-1;i++){
      if((a[i]>a[i-1] && a[i]<a[i+1]) || (a[i]<a[i-1] && a[i]>a[i+1])){
        count++;
      }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	for (;;)
	{
		int h, w;
		cin >> h >> w;

		if (h == 0 && w == 0)
		{
			break;
		}

		for (int i = 0; i < h; i++)
		{
			for (int j = 0; j < w; j++)
			{
				if (i == 0 || i == h-1 || j == 0 || j == w-1)
				{
					cout << "#";
				}
				else
				{
					cout << ".";
				}
			}
			cout << endl;
		}
		cout << endl;
	}
}


Measured memory_bytes: 3080
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;


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

  ll H, W;
  cin >> H >> W;

  REP(i,H){
    string m;
    cin >> m;
    cout << m << "\n" << m << "\n";
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <vector>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <ctime>
#include <random>
#include <bitset>
#include <cstring>
#define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) 
#define ll long long
#define eps 1e-8
#define inf INT_MAX
using namespace std;

inline int FastI() {
	char c = ' ';
	int ans = 0;
	bool minus = 0;
	while (!isdigit(c)) {
		if (c == '-')
			minus = 1;
		c = getchar();
		if (!isdigit(c))
			minus = 0;
	}
	while (isdigit(c)) {
		ans *= 10ll;
		ans += c - '0';
		c = getchar();
	}
	return (minus ? -ans : ans);
}

int main() {
	speed;
	int a = FastI(), b = FastI(), c = FastI();
	if (b * 31 + c <= 154)
		cout << "Heisei";
	else
		cout << "TBD";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    string s,s1;
    cin>>s>>s1;
    int cnt=0;
    for(int i=0;i<s.size();i++) {
        if(s[i]!=s1[i]) cnt++;
    }
    cout<<cnt<<endl;
}


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

#define MAX_N 100000
#define MAX_M 100

using namespace std;

int N, M;
int A[MAX_N];

vector<int> solve()
{
    vector<int> B;

    vector<int> idx_odds;
    for ( int i = 0; i < M; i++ )
        if ( A[i] % 2 ) idx_odds.push_back( i );

    switch ( idx_odds.size() )
    {
    case 2:
        swap( A[idx_odds[1]], A[M - 1] );
    case 1:
        swap( A[idx_odds[0]], A[0] );
        break;
    case 0:
        break;
    default:
        return B;
    }

    if ( A[0] > 1 ) B.push_back( A[0] - 1 );
    switch ( M )
    {
    case 1:
        B.push_back( 1 );
        break;
    // case 2:
    //     B.push_back( A[1] + 1 );
    //     break;
    default:
        for ( int i = 1; i < M - 1; i++ ) B.push_back( A[i] );
        B.push_back( A[M - 1] + 1 );
    }

    return B;
}

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

    for ( int i = 0; i < M; i++ ) cin >> A[i];

    auto ans = solve();

    if ( ans.size() == 0 )
        cout << "Impossible" << endl;
    else
    {
        for ( int i = 0; i < M - 1; i++ ) cout << A[i] << " ";
        cout << A[M - 1] << endl;

        cout << ans.size() << endl;

        for ( int i = 0; i < ans.size() - 1; i++ ) cout << ans[i] << " ";
        cout << ans[ans.size() - 1] << endl;
    }

    return 0;
}


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

int main() {
  std::cout<<std::fixed<<std::setprecision(10);
  int N, K;
  cin >> N >> K;

  int s;
  double p=0;
  int num;
  for(int i=1;i<=N;i++){
    if(i<K) {
      s=i;
      num=0;
      while(1){
        s*=2;
        num+=1;
        if(s>=K) break;
      }
      p += 1.0/ ( pow(2.0,(double)num) * (double) N );
    }else{
      p += 1.0/(double)N;
    }
  }
  cout << p << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3

import sys

DEBUG = False

def read(t):
    return t(sys.stdin.readline().rstrip())


def read_list(t, sep = " "):
    return [t(s) for s in sys.stdin.readline().rstrip().split(sep)]


def dprint(*args, **kwargs):
    if DEBUG:
        print(*args, **kwargs)
    return

def is_panlindrome(s):
    dprint("s: %s" % (s))
    if list(s) == list(reversed(s)):
        return True
    return False

def judge(s):
    if not is_panlindrome(s):
        return False
    if not is_panlindrome(s[0:(len(s) - 1)//2]):
        return False
    if not is_panlindrome(s[(len(s) + 3) // 2 - 1: len(s)]):
        return False
    return True


def main():
    s = read(str)
    j = judge(s)
    if j:
        print("Yes")
    else:
        print("No")

    pass


if __name__ == "__main__":
    main()

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

using namespace std;

typedef long long	ll;

int n;
vector< string > gen;
void solve(int i, int used, string &tmp){
	if(i == n){
		gen.push_back(tmp);
		return;
	}

	for(int k = 0 ; k < used; k++){
		tmp[i] = 'a' + k;
		solve(i + 1, used, tmp);
	}

	tmp[i] = 'a' + used;

	solve(i + 1, used + 1, tmp);
}

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

	cin >> n;

	string tmp(n, 'a');

	solve(0, 0, tmp);

	for(auto s: gen){
		cout << s << '\n';
	}

	return 0;
}

Measured memory_bytes: 7796
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,ll>
const ll MOD=998244353;
const int INF=1e9;
const double PI=acos(-1);


int main() {
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    string s,t;
    cin >> s >> t;
    rep(i,n) cout << s[i] << t[i];
    cout << endl;

    return 0;

}


Measured memory_bytes: 3668
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
#define int ll
#define fi first
#define se second
#define Sort(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/4
#define INTINF INT_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T &a, T b){if(a < b){a = b;return true;}return false;}
template<class T> inline bool chmin(T &a, T b){if(a >= b){a = b;return true;}return false;}
/*----------------------------------------------------------------*/
const int MOD = 998244353;
// const int MOD = 1000000007;

/*----------------------------------------------------------------*/
signed main(){

	int x,n;
	cin  >> x >> n;

	int p[111] = {};

	rep(i,n){
		int v;cin >> v;
		p[v] = 1;
	}


	int mini = 101;
	int id = -1;
	for(int i = 101;i >= 0;i--){
		if(p[i] == 0){
			if(chmin(mini,abs(i-x)))id = i;
		}
	}
	cout << id << endl;
	cerr << mini << endl;




	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=gnu++17 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://pakencamp-2019-day3.contest.atcoder.jp/tasks/pakencamp_2019_day3_c
// rm -r -f test;oj dl https://atcoder.jp/contests/abc170/tasks/abc170_a


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

#define add(i,j) (sqrt(cakes[i]*cakes[j]) * 2 - cakes[i] + cakes[j])
vector< string > split( const string& str, string del){
  char *p,  *str_buff = new char[str.size() + 1], first = 0;
  vector< string > ret;
  strcpy( str_buff, str.c_str());
  while(p = strtok((first++ ? NULL : str_buff), del.c_str())){
    ret.push_back(p);
  }
  delete str_buff;
  return ret;
}
int main(){
  string strb;
  while(getline(cin, strb)){
    vector< string > strs = split( strb, " ");
    int box = atoi(strs[0].c_str());
    vector< int > cakes(strs.size() - 1);
    for(int i = 0; i < strs.size() - 1; i++){
      cakes[i] = atoi(strs[i + 1].c_str());
    }

    const int INF = 1 << 30;
    double dp[12][1 << 12];
    fill_n( *dp, 12 * (1 << 12), INF);

    for(int i = 0; i < cakes.size(); i++){
      dp[i][1 << i] = cakes[i] * 2;
    }

    for(int j = 0; j < 1 << cakes.size(); j++){
      for(int i = 0; i < cakes.size(); i++){
        if(dp[i][j] == INF) continue;
        for(int k = 0; k < cakes.size(); k++){
          if(j >> k & 1) continue;
          dp[k][j|(1 << k)] = min( dp[k][j|(1 << k)], dp[i][j] + add(i,k));
        }
      }
    }
    bool judge = false;
    for(int i = 0; i < cakes.size(); i++){
      judge |= dp[i][(1 << cakes.size()) - 1] <= box;
    }
    if(judge) cout << "OK" << endl;
    else cout << "NA" << endl;
  }
  return 0;
}

Measured memory_bytes: 1584
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Tarek
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DRedistribution solver = new DRedistribution();
        solver.solve(1, in, out);
        out.close();
    }

    static class DRedistribution {
        static int[] memo;
        static int mod = (int) 1e9 + 7;

        static int dp(int sum) {
            if (sum == 0) return 1;
            if (sum < 0) return 0;
            if (memo[sum] != -1) return memo[sum];
            int ans = 0;
            for (int j = 3; j <= sum; j++) {
                ans = (ans + dp(sum - j)) % mod;
            }
            return memo[sum] = ans;
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int x = in.nextInt();
            memo = new int[x + 1];
            Arrays.fill(memo, -1);
            out.println(dp(x));
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 33180
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(type, x, y) do { type tmp = x; x = y; y = tmp; } while (0)

#define MOD 1000000007 

int main(void){
    long x;
    scanf("%ld",&x);

    long ans=(x/11)*2;
    if(x%11==0) ans+=0;
    else if(x%11<=6) ans+=1;
    else ans+=2;

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

    return 0;
}

Measured memory_bytes: 128
using System;

namespace atcorder
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            atcorder.Irreversible_operation.Run();
        }
    }
    public class Irreversible_operation
    {
        public Irreversible_operation()
        {
        }
        public static void Run()
        {
            string S;
            S = Console.ReadLine();
            long num_B = 0;
            long result = 0;
            for (int i = 0; i < S.Length; i++)
            {
                if (S[i] == 'W')
                {
                    result += num_B;
                }else{
                    num_B++;
                }
            }
            Console.WriteLine(result);
        }
    }
}


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

Measured memory_bytes: 596
import sys
input=sys.stdin.readline
n=int(input())
S=[list(input()) for i in range(n)]
def check(s,b):
    for i in range(n-1):
        for j in range(i+1,n):
            if s[i][(j-b)%n]!=s[j][(i-b)%n]:
                return False
    return True
ans=0
for i in range(n):
    if check(S,i):ans+=n
print(ans)


Measured memory_bytes: 43248
import java.io.*;

public class Main
{
	public static void main(String[] args) throws IOException
	{
		int x,x_3;
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String line =reader.readLine();
		x = Integer.parseInt(line);
		x_3 = x*x*x;
		System.out.println(x_3);
	}
}

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

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

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  char x[2], y[2];

  scanf("%s", x);
  scanf("%s", y);

  if(x[0] < y[0]) printf("<");
  if(x[0] > y[0]) printf(">");
  if(x[0] == y[0]) printf("=");
  return 0;
}
		  


Measured memory_bytes: 128
#include <iostream>
#include <string>
using namespace std;
int main(){
string S;
  cin>>S;
int len,ans;
  ans=0;
  len=S.length();
for(int i=0;i<len;i++){
if(S[i]!=S[len-1-i]){ans++;}
} 
  cout<<ans/2;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
ifACL = [0]*N
cWAL = [0]*N
psL = []
AC = 0
WA = 0
p = 0
s = 0
for _ in range(M):
  p, s = map(str, input().split())
  p = int(p)
  if ifACL[p-1] == 0 and s == "WA":
    cWAL[p-1] += 1
  elif ifACL[p-1] == 0 and s == "AC":
    AC += 1
    WA += cWAL[p-1]
    ifACL[p-1] = 1

print(AC, WA)


Measured memory_bytes: 10204
n = gets.to_i
x_hash = {}
y_hash = {}
xy_hash = {} # key: x-y
xpy_hash = {} # key: x+y
n.times do
  x, y, u = gets.split(" ")
  x = x.to_i
  y = y.to_i
  if u == "U" || u == "D"
    x_hash[x] ||= []
    x_hash[x] << [y, u] 
  else
    y_hash[y] ||= []
    y_hash[y] << [x, u]
  end

  if u == "U" || u == "L"
    key = "UL"
  else
    key = "DR"
  end
  xy_hash[x - y] ||= { "UL" => [], "DR" => [] }
  xy_hash[x - y][key] << [x, y, u]

  if u == "U" || u == "R"
    key = "UR"
  else
    key = "DL"
  end
  xpy_hash[x + y] ||= { "UR" => [], "DL" => [] }
  xpy_hash[x + y][key] << [x, y, u]
end

min_sec = 100_000_000_000
x_hash.each do |_x, arr|
  sarr = arr.sort_by{|y, _| y}
  sarr[0...(sarr.length-1)].each_with_index do |(y, u), i|
    ny, nu = sarr[i + 1]
    if u == "U" && nu == "D"
      t = 5 * (y - ny).abs
      min_sec = t if t < min_sec
    end
  end
end
y_hash.each do |_y, arr|
  sarr = arr.sort_by{|x, _| x}
  sarr[0...(sarr.length-1)].each_with_index do |(x, u), i|
    nx, nu = sarr[i + 1]
    if u == "R" && nu == "L"
      t = 5 * (x - nx).abs
      min_sec = t if t < min_sec
    end
  end
end
xy_hash.each do |_diff, hash|
  sarr = hash["UL"].sort_by{|x, y, _| x}
  sarr[0...(sarr.length-1)].each_with_index do |(x, y, u), i|
    nx, _ny, nu = sarr[i + 1]
    if u == "U" && nu == "L"
      t = 10 * (x - nx).abs
      min_sec = t if t < min_sec
    end
  end
  sarr = hash["DR"].sort_by{|x, y, _| x}
  sarr[0...(sarr.length-1)].each_with_index do |(x, y, u), i|
    nx, _ny, nu = sarr[i + 1]
    if u == "R" && nu == "D"
      t = 10 * (x - nx).abs
      min_sec = t if t < min_sec
    end
  end    
end
xpy_hash.each do |_diff, hash|
  sarr = hash["UR"].sort_by{|x, y, _| x}
  sarr[0...(sarr.length-1)].each_with_index do |(x, y, u), i|
    nx, _ny, nu = sarr[i + 1]
    if u == "R" && nu == "U"
      t = 10 * (x - nx).abs
      min_sec = t if t < min_sec
    end
  end
  sarr = hash["DL"].sort_by{|x, y, _| x}
  sarr[0...(sarr.length-1)].each_with_index do |(x, y, u), i|
    nx, ny, nu = sarr[i + 1]
    if u == "D" && nu == "L"
      t = 10 * (x - nx).abs
      min_sec = t if t < min_sec
    end
  end    
end

puts min_sec == 100_000_000_000 ? "SAFE" : min_sec

Measured memory_bytes: 291672
#include<bits/stdc++.h>
using namespace std;
int main(){
int  n ;
cin>>n;
vector<double>a( n) ;
for(int i = 0 ; i < n ; i++){
    cin>>a[i] ;
}

sort(a.begin() , a.end());
   // vector<double>b(a.begin() , a.end()) ;
double  m = (a[0] + a[1])/2;
for(int i = 2 ; i <=  n -1 ; i++){
   // b.push_back((a[n + i -1] + a[n + i - 2])/2) ;
    m = (m + a[i])/2 ;
    }
cout<<m<<endl;


}


Measured memory_bytes: 256
using System;


namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            string ABC = Console.ReadLine();
            string[] abc = (ABC.Split(' '));
            int[] num = new int[3];         //int??????????????????????????±?????????
            num[0] = int.Parse(abc[0]);     //string?????±???????????°??????int?????±????§????
            num[1] = int.Parse(abc[1]);
            num[2] = int.Parse(abc[2]);
            
            Array.Sort(num);                //??????????????´???????????????

            Console.WriteLine(num[0] + " " + num[1] + " " + num[2]);

            
        }
    }
}

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

void solve(long long N, long long K, std::vector<long long> h) {
  auto dp = vector<ll>(N, 1e9+5);
  dp[0] = 0;
  for (int i = 1; i < N; i++) {
    for (int j = i - 1; j >= 0 and i - j <= K; j--) {
	dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]));
    }
  }
  cout << dp.back() << endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
  long long N;
  scanf("%lld", &N);
  long long K;
  scanf("%lld", &K);
  std::vector<long long> h(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &h[i]);
  }
  solve(N, K, std::move(h));
  return 0;
}


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

namespace ABC103B
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            var T = Console.ReadLine();

            for(var i=0; i<S.Length; i++)
            {
                S = S[S.Length - 1] + S.Substring(0, S.Length - 1);

                if(S == T)
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }
            Console.WriteLine("No");
        }
    }
}


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

int main(){
  int N, D, X;
  cin >> N >> D >> X;
  vector<int> A(N);
  for (int i=0; i<N; i++) cin >> A.at(i);
  for (int i=0; i<N; i++) {
    for (int day=1; day<=D; day+=A.at(i)) X++;
  }
  cout << X << endl;
}

Measured memory_bytes: 256
N = int(input())
h = list(map(int, input().split()))
d = [0] * N

mp = 0

while (sum(h) != sum(d)):
    l = 0
    x = 0
    mo = 0
    for i in range(0,N):
        x = i
        if ((h[i] != d[i]) and mo == 0):
            l = i
            mo = 1
        if (((h[i] == d[i]) and mo == 1)):
            mo = 2
        if ((i==N-1) and (mo ==1)):
            x += 1
            mo = 2
        if (mo == 2):
            for j in range(l, x):
                d[j] += 1
            mp += 1
            break
print(mp)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(void) {
	int a, b, c;
	cin >> a >> b>>c;
	if (a > b) {
		int tem = a;
		a = b;
		b = tem;
	}
	if (b > c) {
		int tem = b;
		b = c;
		c = tem;
	}
	if (a > b) {
		int tem = a;
		a = b;
		b = tem;
	}
	cout << a << " " << b << " " << c << endl;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define PF push_front
#define MP make_pair
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int maxn = 2e5 + 5;

int a[maxn];
map <int, int> mp;

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> a[i];
		mp[a[i]] ++;
	}
	sort(a, a + n, greater<int>());
	int ans = 0;
	for (int i = 0; i < n; i++){
		if (mp[a[i]] != 0){
			mp[a[i]] --;
			for (int j = 30; j >= 0; j--){
				if (mp[(1 << j) - a[i]] > 0){
					ans ++;
					mp[(1 << j) - a[i]] --;
				}
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 300160
n = int(input())
A = list(map(int, input().split()))

result_list = []
result_list.append(A[:])

for i in range(1,len(A)):
    key = A[i]
    j = i -1
    while j >= 0 and A[j] > key:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = key
    result_list.append(A[:])

for i in range(n):
    if i > len(result_list):
        print(' '.join(str(n) for n in result_list[-1]))
    print(' '.join(str(n) for n in result_list[i]))

Measured memory_bytes: 7580
N, M = map(int, input().split())

if N == 1 or M == 1:
    if N == 1 and M == 1:
        res = 1
    else:
        res = max([N,M]) - 2
elif N == 2 or M == 2:
        res = 0
else:
    res = (M*N) - (N*2) - ((M-2)*2)

print(res)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
         
typedef long long ll;
using namespace std;
        
#define F first
#define S second
#define sqr(x) x*x
#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define repit(i, n) for(auto it = n.begin(); it != n.end(); ++it)
       
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b){if(b==0)return a;else return gcd(b,a%b);}
int lcm(int a,int b){return abs(a*b)/gcd(a,b);}
     
int main(){ios_base::sync_with_stdio(0);cin.tie(0);

           int a,b,c;
           cin >> a>> b>>c;
           set<int> s;
           s.insert(a);
           s.insert(b);
           s.insert(c);
           cout << s.size();
}

Measured memory_bytes: 892
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {        
    int n;
    cin >> n;
    cout << n / 3 << endl;
}


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

int main() {
    const long long INF = 1LL << 60;

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

    long long int dp[100500];
    for(int i=0; i<100500; i++){
        dp[i] = INF;
    }

    dp[0]=0;

    for(int i=0; i<N; i++){
        for(int j=1; j<=K; j++){
            dp[i+j] = min(dp[i+j], dp[i]+abs(H[i+j]-H[i]) );
        }
    }

    cout << dp[N-1] << endl; 
}

Measured memory_bytes: 1408