akhauriyash/Code-Regression huggingface dataset:
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-12;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void){
	int w,h,K,n,i;cin>>w>>h>>K>>n;
	int H=(h+1)/2,W=(w+1)/2;
	vector<pair<int,int>>dog(n+1);
	dog[n]=mp(mod,mod);
	for(i=0;i<n;i++){cin>>dog[i].sec>>dog[i].fir;}
	SO(dog);
	K-=W;
	if(K<0){cout<<-1<<endl;return 0;}
	pair<int,int>mae=mp(-1,-1);
	int ans=0,dp=0,ep=0,fp=0;
	for(auto it:dog){
		if(mae.fir!=it.fir||mae.sec+6<=it.sec){//清算します
			ans+=min({dp,ep,fp});
			dp=0;ep=0;fp=0;
			if(it.sec==1){dp=99;}
			
		}else{
			for(i=mae.sec+1;i<=it.sec;i++){
				if(i%2==1){int sp=min(dp,ep);dp=fp;ep=sp;fp=sp;}
			}
		}
		if(it.sec%2==0){fp+=2;}//中間
		else{ep++;}
		if(it.sec==w){fp=mod;}
		mae=it;
	}
	//cerr<<"ans="<<ans<<endl;
	cout<<max(0,(H-1)*W-K)+max(0,ans-K)<<endl;
	return 0;
}



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

int main(){
    string S;
    cin >> S;
    vector<string> ans = {"Sunny", "Cloudy", "Rainy", "Sunny"};
    for(int i = 0; i < 3; i++){
        if(S == ans[i]){
            cout << ans[i + 1];
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
  int R;
  cin >> R;
  string ans = "";
  if (R < 1200)
    ans = "ABC";
  else if (R < 2800)
    ans = "ARC";
  else
    ans = "AGC";
  cout << ans << endl;
  return 0;
}

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

int main()
{
	int n;
	cin>>n;
	string str = to_string(n);
	for(int i = 0 ; i < str.size() ; i ++)
	{
		if(str[i] =='7')
			{
				cout<<"Yes"<<endl;
				return 0;
			}
	}
	cout<<"No"<<endl;
	return 0;
}	

Measured memory_bytes: 3696
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
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 int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int h,w;
    cin >> h >> w;
    int i,j;
    cin >> i >> j;
    cout << h*w-i*w-j*h+i*j << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()

#pragma region GCD
ll gcd(ll a, ll b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region LCM
ll lcm(ll a, ll b)
{
	return (a*b) / gcd(a, b);
}
#pragma endregion


int main()
{
	ll a, b, c, d; cin >> a >> b >> c >> d;
	ll lcmCD = lcm(c, d);
	ll divA = (a - 1) / c + (a - 1) / d - (a - 1) / lcmCD;
	ll divB = b / c + b / d - b / lcmCD;
	ll ans = (b-a+1) - divB + divA;
	cout << ans << endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (r, g, b, n) = readLine()!!.split(' ').map(String::toInt)
    var cnt = 0
    for (rr in (0..n / r)) {
        for (gg in (0..n / g)) {
            val x = n - (rr * r + gg * g)
            if (x < 0) break
            if (x % b == 0) cnt++
        }
    }
    println(cnt)
}


Measured memory_bytes: 38160
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>

using namespace std;

template<typename T> 
void show(T a){
  for(auto i : a){ cout << i << " "; }
  cout << endl;
}

bool isMoreThanOnce(string& num){
  bool f3 = false;
  bool f5 = false;
  bool f7 = false;
  for(char& i : num){
    if(f3&&f5&&f7) return true;
    else if(i == '3') f3 = true;
    else if(i == '5') f5 = true;
    else if(i == '7') f7 = true;
  }
  if(f3&&f5&&f7) return true;
  else return false;
}

void dfs(int limitLen, int limitNum, string& num, int& count){
  if(num.size() > limitLen)
    return;
  int intnum = 0;
  if(num.size() > 0 && isMoreThanOnce(num)) {
    intnum = stoi(num);
    if(intnum <= limitNum){
      //cout << num << " " << intnum <<  endl;
      count += 1;
    }
  }
  
  num.push_back('3');
  dfs(limitLen, limitNum, num, count);
  num.pop_back();
  
  num.push_back('5');
  dfs(limitLen, limitNum, num, count);
  num.pop_back();
 
  num.push_back('7');
  dfs(limitLen, limitNum, num, count);
  num.pop_back();
  
}

int main(int argc, char *argv[]){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  
  int n;
  cin >> n;
  cout << endl;
  string n_str = to_string(n);
  string tmp = "";
  int count = 0;
  dfs(n_str.size(), n, tmp, count);
  cout << count << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<string>
#include<queue>
#include<utility>
#include<cmath>
#include<sstream>
#include<istream>
#include<numeric>

using namespace std;


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

  long long sum = 0;

  for(int i=1; i<=N; i++){
    if((i%3 != 0) && (i%5 != 0)){
      sum += i;
    }
  }

  cout << sum << endl;

  return 0;
}


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

using namespace std;

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

typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll MOD = 1e9+9;

mat mul(mat const&A, mat const& B) {
  mat C(A.size(), vec(B[0].size()));
  for(int i=0; i<A.size(); i++) {
    for(int k=0; k<B.size(); k++) {
      for(int j=0; j<B[0].size(); j++) {
        C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % MOD;
      }
    }
  }
  return C;
}

mat pow(mat A, ll n) {
  mat B(A.size(), vec(A.size()));
  for(int i=0; i<A.size(); i++) {
    B[i][i] = 1;
  }
  while(n > 0) {
    if(n & 1) B = mul(B, A);
    A = mul(A, A);
    n >>= 1;
  }
  return B;
}

int W; ll H; int N;
mat coef;
vector<pair<ll, vector<int>>> vs;
mat xsmat;

void make_identity_coef() {
  coef.clear(); coef.resize(W); rep(i, W) coef[i].resize(W);
  rep(i, W) rep(j, 3)
    if(i+j-1 >= 0 && i+j-1<W)
      coef[i][i+j-1] = 1;
}

void init_xsmat() {
  xsmat.clear();
  xsmat.resize(W);
  rep(i, xsmat.size()) xsmat[i].resize(1);
  xsmat[0][0] = 1;
}

void input_blocks() {
  vs.clear();
  unordered_map<ll, vector<int>> y2xs;
  rep(i, N) {
    ll x, y; scanf("%lld%lld", &x, &y); x--, y--;
    y2xs[y].push_back(x);
  }
  for(auto& e: y2xs) vs.emplace_back(e.first, e.second);
  vs.emplace_back(H - 1, vector<int>());
  sort(vs.begin(), vs.end());
}

void update_n_step(ll n) {
  xsmat = mul(pow(coef, n), xsmat);
}

int main() {

  for(int tc = 1; cin >> W >> H >> N && (W|H|N); tc++) {
    input_blocks();
    make_identity_coef();
    init_xsmat();
    ll curr = 0;
    rep(i, (int)vs.size()) {
      update_n_step(vs[i].first - curr);
      curr = vs[i].first;
      for(auto& x: vs[i].second) xsmat[x][0] = 0;
    }
    printf("Case %d: %lld\n", tc, xsmat[W-1][0]);
  }

  return 0;
}

Measured memory_bytes: 3436
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
using namespace std;
using namespace __gnu_pbds;
 
#define int long long
#define pii pair<int,int>
#define pqi priority_queue<int>
#define pb push_back()
#define INF 1000000000000000000
#define pi acos(-1)
#define deb(x) cout<<#x" = "<<x<<" "
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
#define all(x) x.begin(),x.end()
const int modu=1e9+7;
#define ull unsigned long long
 
void clesize(vector<int>&v,int n,int val=0){ v.clear(),v.resize(n,val); }   
 
int bigmod(int n,int p){
    if(p==0) return 1;
    int x=bigmod(n,p/2)%modu;
    x=(x*x)%modu;
    if(p%2) return (x*n)%modu;
    return x;
}
 
int modInverse(int a){
    return bigmod(a,modu-2)%modu;
}
 
 
int add(int a,int b){
    int ans=(a%modu + b%modu)%modu;
    while(ans<0) ans+=modu;
    return ans;
}
 
int mul(int a,int b){
    int ans=(a%modu * b%modu)%modu;
    while(ans<0) ans+=modu;
    return ans;
}
 
// starts here

int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie();cout.tie();
    //If you hack my code , You are gay;
    int n,m;
    cin>>n>>m;
    int grid[n][m],ans[n][m];
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            ans[i][j]=INF;
            char x;
            cin>>x;
            grid[i][j] = (x=='.') ? 0:1;
        }
    }
    ans[0][0]=grid[0][0];
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(j+1<m){
                int now=ans[i][j];
                if(grid[i][j+1] && !grid[i][j]) now++;
                ans[i][j+1]=min(ans[i][j+1],now);
            }
            if(i+1<n){
                int now=ans[i][j];
                if(grid[i+1][j] && !grid[i][j]) now++;
                ans[i+1][j]=min(ans[i+1][j],now);
            }
        }
    }
    cout<<ans[n-1][m-1];
    //endscreen();
    return 0;
 
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5 << 28, MOD = 1e9 + 7;

string A,B,C;
void input() {
  cin>>A;cin>>B;cin>>C;
}
void solve() {
  if (A[A.size()-1] == B[0] && B[B.size()-1]==C[0]){
    cout<<"YES"<<endl;
  }
  else cout<<"NO"<<endl;
  ;
  ;
}
signed main() {
  input();
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mod 1000000007
void solve()
{
	ll n;
	cin>>n;
	string s1,s2;
	cin>>s1>>s2;
	ll ans=1;
	ll i=1;
	if(s1[0]==s2[0])
	{
		ans*=3;
	}
	else
	{
		ans*=6;
		i++;
	}
	for(;i<n;i++)
	{
		if(s1[i]==s2[i])
		{
			if(s1[i-1]!=s2[i-1])
				ans*=1,ans%=mod;
			else
				ans*=2,ans%=mod;
		}
		else
		{
			if(s1[i-1]!=s2[i-1])
				ans*=3,ans%=mod;
			else
				ans*=2,ans%=mod;
			i++;
		}
	}
	cout<<ans;
	return;
}


int main()
{
	fast;
	ll q;
	q=1;
	// cin>>q;
	while(q--)
	{
		solve();
	}
	return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

int bfs(vector<vector<int> >& G, int n, int s, int t) {
  if (s == t) {
    return 0;
  }
  vector<bool> vis(n);
  queue<pair<int, int> > q;
  q.emplace(s, 0);
  while (!q.empty()) {
    pair<int, int> p = q.front();
    int i = p.first;
    int a = p.second;
    q.pop();
    for (int j : G[i]) {
      if (!vis[j]) {
        if (j == t) {
          return a + 1;
        }
        vis[j] = true;
        q.emplace(j, a + 1);
      }
    }
  }
  return -1;
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int> > G(n * 3);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    G[u * 3 + 0].push_back(v * 3 + 1);
    G[u * 3 + 1].push_back(v * 3 + 2);
    G[u * 3 + 2].push_back(v * 3 + 0);
  }
  int s, t;
  cin >> s >> t;
  s--;
  t--;
  int ans = bfs(G, n * 3, s * 3, t * 3);
  cout << (ans == -1 ? -1 : ans / 3) << endl;
  return 0;
}


Measured memory_bytes: 16640
from typing import List, Any


def read_int() -> int:
    return int(input().strip())


def read_ints() -> List[int]:
    return list(map(int, input().strip().split(' ')))


def solve() -> Any:
    N = read_int()
    count = 0
    for _ in range(N):
        d0, d1 = read_ints()
        if d0 == d1:
            count += 1
            if count > 2:
                return 'Yes'
        else:
            count = 0
    return 'No'


if __name__ == '__main__':
    print(solve())


Measured memory_bytes: 70280
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.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
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);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt(), b = in.nextInt(), c = in.nextInt();
            int[] arr = {a, b, c};
            Arrays.sort(arr);
            int answer = arr[2] - arr[1];
            arr[0] += answer;
            arr[1] += answer;
            while (arr[0] < arr[2]) {
                arr[0] += 2;
                answer++;
            }
            if (arr[0] != arr[2]) answer++;
            out.println(answer);
        }

    }

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

        public InputReader(InputStream inputStream) {
            reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        private void fillTokenizer() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        }

        public String next() {
            fillTokenizer();
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 23380
#include<bits/stdc++.h>
using namespace std;
int a[2005];
int main() {
	long long n,k;
	cin>> n >> k;
	for(int i=1; i<=n; ++i)
		cin >> a[i];
	long long sum=0;
	long long num=1e9+7;
	for(int i=1; i<=n; ++i) 
	{
		long long left=0,right=0;
		for(int j=1;j<i;++j)
		   if(a[j]<a[i]) ++left;
		for(int  j=i+1;j<=n;++j)
		   if(a[i] > a[j]) ++right;
		long long t=0;
		t=k*(k-1)/2;
		t%=num;
		t*=left;
		t%=num;
		sum+=t;
		sum%=num;
		t=k*(k+1)/2;
		t%=num;
		t*=right;
		t%=num;
		sum+=t;
		sum%=num;
	}
	cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 3628
import java.util.Scanner;

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

    public static void solve(Scanner sc) {
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.println(n * a > b ? b : n * a);
    }
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000


int main(){
	
	int N;
	cin>>N;
	
	vector<int> T(N),A(N);
	
	for(int i=0;i<N;i++)cin>>T[i];
	for(int i=0;i<N;i++)cin>>A[i];
	
	vector<int> l1(N),r1(N),l2(N),r2(N);
	
	for(int i=0;i<N;i++){
		if(i==0){
			l1[i] = T[i];
			r1[i] = T[i];
		}
		else{
			if(T[i]==T[i-1]){
				l1[i] = 1;
				r1[i] = T[i];
			}
			else{
				l1[i] = T[i];
				r1[i] = T[i];
			}
		}
	}
	
	reverse(A.begin(),A.end());
	
	for(int i=0;i<N;i++){
		if(i==0){
			l2[N-1-i] = A[i];
			r2[N-1-i] = A[i];
		}
		else{
			if(A[i]==A[i-1]){
				l2[N-1-i] = 1;
				r2[N-1-i] = A[i];
			}
			else{
				l2[N-1-i] = A[i];
				r2[N-1-i] = A[i];
			}
		}
	}
	
	int ans = 1;
	
	for(int i=0;i<N;i++){
		int L = max(l1[i],l2[i]);
		int R = min(r1[i],r2[i]);
		if(L>R){
			cout<<0<<endl;
			return 0;
		}
		
		ans = mod(ans * (R-L+1));
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=(a);i<(n);i++)
#define per(i,a,n) for (int i=(n)-1;i>=(a);i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef long double ld;
const ll mod=1000000007;
// head

int a,b;
int main() {
	scanf("%d%d",&a,&b);
	printf("%d",a*b);
}


Measured memory_bytes: 3832
def cross(c1, c2):
    return c1.real * c2.imag - c1.imag * c2.real

def print_cross_point(p1, p2, p3, p4):
    # p1 and p2 are end points of a segment.
    # p3 and p4 are end points of the other segment.
    base = p4 - p3
    hypo1 = p1 - p3
    hypo2 = p2 - p3
    d1 = abs(cross(base, hypo1)) / abs(base)
    d2 = abs(cross(base, hypo2)) / abs(base)
    cp = p1 + d1 / (d1 + d2) * (p2 - p1)
    print("{0:.10f} {1:.10f}".format(cp.real, cp.imag))

import sys

file_input = sys.stdin

sq = file_input.readline()

for line in file_input:
    x_p0, y_p0, x_p1, y_p1, x_p2, y_p2, x_p3, y_p3 = map(int, line.split())
    p0 = x_p0 + y_p0 * 1j
    p1 = x_p1 + y_p1 * 1j
    p2 = x_p2 + y_p2 * 1j
    p3 = x_p3 + y_p3 * 1j
    print_cross_point(p0, p1, p2, p3)

Measured memory_bytes: 7784
using System;

class Program {

    private static int Main() {
        var input = Console.ReadLine();
        var values = input.Split( ' ' );

        int r = int.Parse( values[ 0 ] );
        int c = int.Parse( values[ 1 ] );

        int[ , ] data = new int[ r + 1, c + 1 ];

        for( int i = 0; i < r; ++i ) {
            input = Console.ReadLine();
            values = input.Split( ' ' );

            int sum = 0;
            for( int j = 0; j < c; ++j ) {
                var value = int.Parse( values[ j ] );
                data[ i, j ] = value;
                data[ r, j ] += value;
                sum += value;
            }
            data[ i, c ] = sum;
            data[ r, c ] += sum;
        }

        for( int i = 0; i < r + 1; ++i ) {
            for( int j = 0; j < c + 1; ++j ) {
                Console.Write( data[ i, j ] );
                if( j != c ) { Console.Write( ' ' ); }
            }
            Console.WriteLine();
        }

        return 0;
    }

}

Measured memory_bytes: 19956
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);
        String S = stdIn.nextLine();
;
        
        if( S.charAt(2) != S.charAt(3) || S.charAt(4) != S.charAt(5))
            System.out.print("No");
        else
            System.out.print("Yes");
        
        
  
    }
}

Measured memory_bytes: 21844
n,k = map(int, input().split())
h   = list(map(int, input().split()))

dp = [10**18] * (10**5+10)
dp[0] = 0

for i in range(n-1):
  k = min(k, n-i-1)
  for j in range(k):
    dp[i+j+1] = min(dp[i+j+1], dp[i] + abs(h[i+j+1] - h[i]))

print(dp[n-1])

Measured memory_bytes: 52448
#include <bits/stdc++.h>
 
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define INF 999999999
#define MOD 1000000007
 
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
 
int iy[]={0, 0, 1, -1};
int ix[]={1, -1, 0, 0};
 
ll n, m, i;
 
int main(){
	cin >> n >> m;
	for(i=1;;i++){
		if(n<m) break;
		n /= m;
	}
	cout << i << endl;
	return 0;
}

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

int main(){
  int n;
  cin>>n;
  vector<long long>a(n+1);
  a[0]=2;
  a[1]=1;
  for(int i=2;i<=n;i++){
    a[i]=a[i-1]+a[i-2];
  }
  cout<<a[n]<<endl;
  return 0;
}

Measured memory_bytes: 256
/**
        Bismilla- hir rahma-nir rahi-m
    @uthor Md Hasibur Rahman (Evan)
                JKKNIU
*/


#include<bits/stdc++.h>
#define         ll              long long
#define         FI              freopen("input.txt","r",stdin)
#define         FO              freopen("output.txt","w",stdout)
#define         PrintCase(i)    printf("Case %d: ",i)
#define         sc(a)           scanf("%d",&a)
#define         scl(a)          scanf("%lld",&a)
#define         rep(i,n)        for(int i=0;i<n;i++)
#define         pb              push_back
#define         MAX             1000000
#define         fast            ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define			endl			"\n"


using namespace std;

bool isPrime(ll a)
{
    for(ll i=2;i*i<=a;i++)
        if(a%i==0)
            return false;
    return true;
}






bool isPowerOfTwo(ll a)
{
    if(a==1)
        return true;
    if(a&1)
        return false;
    while(a)
    {
        a/=2;
        if(a!=1 && a&1)
            return false;
        if(a==1)
            return true;
    }
    return true;
}




ll gcd(ll a, ll b)
{
    if(a<0 || b<0)
    {
        a = abs(a);
        b = abs(b);
    }
    if(a<b)
        swap(a,b);
    if(a%b==0 || b==0)
        return b;
    else
        return gcd(b,a%b);
}



ll lcm(ll a, ll b)
{
    return (a*b)/gcd(a,b);
}



ll power(ll base, ll exponent)
{
    ll ans = 1;
    for(ll i=1;i<=exponent;i++)
        ans*=base;
    return ans;
}




bool isPowerOfX(ll x, ll value)
{
    if(value==1)
        return true;
    while(value)
    {
        value/=x;
        if(value%x && value!=1)
            return false;
    }
    return true;
}


ll X_or(ll for1, ll for2, ll value)
{
	ll arr[7];
	arr[3] = for1^for2;
	//cout<<(for1^for2)<<endl;
	arr[4] = arr[3]^for2;
	arr[5] = arr[4]^arr[3];
	cout<<arr[3]<<" "<<arr[4]<<" "<<arr[5]<<" ..... \n";
	if(value%3==0)
	{
		//cout<<arr[]
		return arr[3];
	}
	else
	{
		ll ret = ((value%3)==1)?arr[4] : arr[5];
		return ret;
	}
}


ll X_nor(ll for1, ll for2, ll value)
{
	ll arr[7];
	arr[3] = ~(for1^for2);
	//cout<<~(for1^for2)<<endl;
	if(arr[3]<0)
		arr[3]*=(-1);
	arr[4] = ~(arr[3]^for2);
	if(arr[4]<0)
		arr[4]*=(-1);
	arr[5] = ~(arr[3]^arr[4]);
	if(arr[5]<0)
		arr[5]*=(-1);
	cout<<arr[3]<<" "<<arr[4]<<" "<<arr[5]<<" ..... \n";
	if(value%3==0)
	{
		return arr[3];
	}
	else
	{
		ll ret = (value%3==1)? arr[4] : arr[5];
		return ret;
	}
}


int main()
{
	vector<ll>v(5);
	cin>>v[0]>>v[1]>>v[2]>>v[3]>>v[4];
	cout<<find(v.begin(),v.end(),0) - v.begin()+1<<endl;
    return 0;
}


Measured memory_bytes: 3544
#include <iostream>
#include <math.h>
#define eps 1e-9

using namespace std;

struct vec2d{
	double x, y;
	vec2d(){}
	vec2d(double x, double y){
		this->x = x, this->y = y;
	}
	double add(double a, double b){
		if(fabs(a+b) < eps * (fabs(a) + fabs(b))) return 0.0;
		return a+b;
	}
	vec2d operator+(vec2d ope){
		return vec2d(add(x, ope.x), add(y, ope.y));
	}
	vec2d operator-(vec2d ope){
		return vec2d(add(x, -ope.x), add(y, -ope.y));
	}
	vec2d operator*(double t){
		return vec2d(x*t, y*t);
	}
	vec2d operator/(double t){
		return vec2d(x/t, y/t);
	}
	double dot(vec2d ope){
		return add(x*ope.x, y*ope.y);
	}
	double cross(vec2d ope){
		return add(x*ope.y, -y*ope.x);
	}
	double norm(){
		double d2 = dot(*this);
		if(d2 > 0) return sqrt(d2);
		return 0.0;
	}
};

double distPP(vec2d p, vec2d q){
	return (p-q).norm();
}

bool isOnL(vec2d p, vec2d q, vec2d x)
{
	return (p-x).cross(q-x) == 0;
}

bool valid;
vec2d getCrossP(vec2d p, vec2d q, vec2d r, vec2d s)
{
	if((q-p).cross(s-r) == 0){
		valid = false;
		return vec2d();
	}
	valid = true;
	double t = (r-p).cross(s-r) / (q-p).cross(s-r);
	return p + (q-p)*t;
}

bool isSamePP(vec2d p, vec2d q)
{
	return (distPP(p, q) < eps);
}

vec2d p[3], q[3];

int dfs(vec2d p[], int cnt)
{
	/*cout << cnt << " ";
	for(int i = 0; i < 3; i++){
		cout << "(" << p[i].x << ", " << p[i].y << ")";
	}
	cout << endl;*/
	
	bool matchP[3], matchQ[3];
	for(int i = 0; i < 3; i++) matchP[i] = matchQ[i] = false;
	for(int i = 0; i < 3; i++){
		for(int j = 0; j < 3; j++){
			if(matchQ[j]) continue;
			if(isSamePP(p[i], q[j])){
				matchP[i] = matchQ[j] = true;
				break;
			}
		}
	}
	bool same = true;
	for(int i = 0; i < 3; i++) same &= matchP[i];
	if(same) return 0;
	
	int dif = 0;
	for(int i = 0; i < 3; i++) dif += !matchP[i];
	if(dif > 4 - cnt) return 5;
	
	int ret = 5;
	
	vec2d np[3];
	for(int i = 0; i < 3; i++) np[i] = p[i];
	for(int i = 0; i < 3; i++){
		if(matchP[i]) continue;
		for(int j = 0; j < 3; j++){
			if(matchQ[j]) continue;
			//cout << i << " " << j << endl;
			if(isOnL(p[i], p[i]+(p[(i+1)%3] - p[(i+2)%3]), q[j])){
				np[i] = q[j];
				ret = min(ret, dfs(np, cnt+1) + 1);
				np[i] = p[i];
			}
			else{
				if(!matchP[(i+1)%3]){
					np[(i+1)%3] = getCrossP(p[(i+2)%3], p[(i+2)%3] + (q[j]-p[i])*1e5, p[(i+1)%3], p[(i+1)%3] + (p[i]-p[(i+2)%3])*1e5);
					if(valid) ret = min(ret, dfs(np, cnt+1) + 1);
					np[(i+1)%3] = p[(i+1)%3];
				}
				if(!matchP[(i+2)%3]){
					np[(i+2)%3] = getCrossP(p[(i+1)%3], p[(i+1)%3] + (q[j]-p[i])*1e5, p[(i+2)%3], p[(i+2)%3] + (p[i]-p[(i+1)%3])*1e5);
					if(valid) ret = min(ret, dfs(np, cnt+1) + 1);
					np[(i+2)%3] = p[(i+2)%3];
				}
			}
		}
	}
	return ret;
}

int main(void)
{
	while(cin >> p[0].x){
		for(int i = 0; i < 3; i++){
			if(i != 0) cin >> p[i].x;
			cin >> p[i].y;
		}
		for(int i = 0; i < 3; i++){
			cin >> q[i].x >> q[i].y;
		}
		
		int ans = dfs(p, 0);
		if(ans >= 5) cout << "Many" << endl;
		else cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3160
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;

#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPL(i,a,n) for(ll i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define SRTVG(v) sort(v.begin(),v.end(),greater<>())
#define SRTV(v) sort(v.begin(),v.end())
#define SRTAG(a,n) sort(a,a+n,greater<>())
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;
typedef pair<int,int> Pii;
typedef map<string,int> si;

template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}
template<class T> void YesNo(T& a) {if(a){cout << "Yes" << ENT;}else{cout << "No" << ENT;}}
template<class T> void YESNO(T& a) {if(a){cout << "YES" << ENT;}else{cout << "NO" << ENT;}}


int N,A,B,C,L[10];

int dfs(int depth,int a,int b,int c){
    if(depth==N && (a==0 || b==0 || c==0)) return INT_MAX/2;
    if(depth==N) return abs(a-A)+abs(b-B)+abs(c-C);
    
    int ret=INT_MAX/2;
    if(a==0) chmin(ret,dfs(depth+1,a+L[depth],b,c));
    else chmin(ret,dfs(depth+1,a+L[depth],b,c)+10);
    if(b==0) chmin(ret,dfs(depth+1,a,b+L[depth],c));
    else chmin(ret,dfs(depth+1,a,b+L[depth],c)+10);
    if(c==0) chmin(ret,dfs(depth+1,a,b,c+L[depth]));
    else chmin(ret,dfs(depth+1,a,b,c+L[depth])+10);
    chmin(ret,dfs(depth+1,a,b,c));

    return ret;
}


int atcoder() {
    cin >> N >> A >> B >> C;
    REP(i,0,N) cin >> L[i];
    
    int ans = dfs(0,0,0,0);
    
    cout << ans << ENT;
    return 0;
}

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


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
	string str;
	int ab[26] = {};
	int i;
	while (getline(cin, str)) {
		for (i = 0; i < str.size(); i++) {
			if (str[i] >= 'a' && str[i] <= 'z') ab[str[i] - 'a']++;
			else if (str[i] >= 'A' && str[i] <= 'Z') ab[str[i] - 'A']++;
		}
		//cout << str << endl;
	}
	for (i = 0; i < 26; i++) {
		cout << (char)('a' + i) << " : " << ab[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 3216
// author: Saman Mahdanian
#include <bits/stdc++.h>

using namespace std;
const int N = 5e5 + 10;
const int MOD = 1e9 + 7;

int _sum (int, int);
int _mul (int, int);
int _pow (int, int);
int gcd (int, int);
void dfs (int, int, int);

int c[N], n;
vector <pair <int, int> > g[N];

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

	cin >> n;
	for (int i = 1; i < n; i++) {
		int v, u, w;
		cin >> v >> u >> w;
		v--; u--;
		g[v].push_back({u, w});
		g[u].push_back({v, w});
	}

	for (int i = 0; i < n; i++)
		if (g[i].size() == 1) {
			dfs (i, -1, 0);
			break;
		}
	for (int i = 0; i < n; i++)
		cout << c[i] << '\n';
}

void dfs (int v, int pv, int comp) {
	c[v] = comp;
	for (pair <int, int> u: g[v])
		if (u.first != pv)
			dfs (u.first, v, (comp ^ u.second) & 1);
}

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

// int choose (int r, int k) {
// 	return _mul (f[k], _mul(inv[r], inv[k - r]));
// }

int _sum (int a, int b) {
	return a + b - (a + b >= MOD? MOD : 0);
}

int _mul (int a, int b) {
	return 1LL * a * b % MOD;
}

int _pow (int a, int b) {
	if (!b) 
		return 1;
	int res = _pow (a, b >> 1);
	res = _mul (res, res);
	if (b & 1)
		res = _mul (res, a);
	return res;
}

// SamMHD :: Jun27-2019 :: Another Day with Shayan...

Measured memory_bytes: 19968
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		// TODO ABC_083_B
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
	    // Scannerクラスのインスタンスをクローズ
		sc.close();

		int ret = 0;
		int sum = 0;
		int iTmp = 0;

		for(int i=1; i<=N; i++) {
			sum = 0;
			iTmp = i;
			while(iTmp != 0) {
				sum += iTmp%10;
				iTmp = iTmp / 10;
			}
			if(A <= sum && sum <= B) {
				ret += i;
			}
		}

		// 出力
		System.out.println(ret);

	}
}


Measured memory_bytes: 35700
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

public class Program
{
    public static void Main(string[] args)
    {
        var l = Console.ReadLine()
            .Split(' ')
            .Select(int.Parse)
            .ToArray();
        var n = l[0];
        var k = l[1];
        var a = Console.ReadLine()
            .Split(' ')
            .Select(int.Parse)
            .GroupBy(x => x)
            .Select(x => new { x.Key, Length = x.Count() })
            .OrderBy(x => x.Length)
            .ToArray();
        if (a.Length > k)
        {
            Console.WriteLine(a.Take(a.Length - k).Sum(x => x.Length));
        }
        else
        {
            Console.WriteLine(0);
        }
    }
}

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

string f(ll n) {
  if(n==0) return "";
  n--;
  return f(n/26) + string(1, 'a'+n%26);
}

int main() {
  ll n;
  cin >> n;
  cout << f(n) << endl;
  return 0;
}

Measured memory_bytes: 3632
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define S second
#define F first
#define ll long long
#define ld long double

using namespace std;

const int N = 1e6 + 5, mod = 1e9 + 7;

// ll pw(ll x, ll y)
// {
//     ll ret = 1;
//     while(y)
//     {
//         if(y&1) ret = (ret * x) % mod;
//         y>>=1;
//         x = (x*x) % mod;
//     }
//     return ret;
// }

int main()
{
    ll n, m, x, sum = 0;
    cin>>n>>m;
    priority_queue<int> Q;
    for(int i = 0 ; i < n ; i++)
    {
        cin>>x;
        Q.push(x);
    }
    while(m--)
    {
        x = Q.top();
        Q.pop();
        Q.push(x/2);
    }
    while(Q.size())
    {
        sum += Q.top();
        Q.pop();
    }
    cout<<sum;
}


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

int main(void){
    string s;
    cin>>s;
    int begin=0,end=0,i=0;

    while(s[i]!='A'){
        begin++;
        i++;
    }
    i=s.size()-1;
    while(s[i]!='Z'){
        end++;
        i--;
    }
    cout<<s.size()-begin-end<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <bitset>
#include <algorithm>
using namespace std;
typedef long long ll;
const int M = 1000000007;
int a, b, f[100001];
int main() {
	cin >> a >> b;
	if (abs(a - b) > 1) {
		puts("0");
		return 0;
	}
	f[0] = 1;
	for (int i = 1; i <= 100000; ++i)
		f[i] = (ll)i*f[i - 1] % M;
	if (a == b)
		cout << f[a] * (ll)f[b] % M * 2 % M << endl;
	else
		cout << f[a] * (ll)f[b] % M << endl;
	return 0;
}

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

void solve(){
	int h, w, k;
	cin >> h >> w >> k;
	char s[h][w];
	for( int i = 0; i < h; i++){
		for( int j = 0; j < w; j++){
			cin >> s[i][j];
		}
	}
	int ans = 0;
	for(int i = 0; i < (1 << h) - 1; i++){
		for(int j = 0; j < (1 << w) - 1; j++){
			int black = 0;
			for(int x = 0; x < h; x++){
				for(int y = 0; y < w; y++){
					if(((i >> x) & 1) == 0 && ((j >> y) & 1) == 0 && s[x][y] == '#'){
						black++;
					}
				}
			}
			if(black == k){
				ans++;
			}
		}
	}
	cout << ans << "\n";
	return ;

}

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

	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
		
	int t = 1;

	while(t--){
		solve();
	}

	return 0;
}

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

using namespace std;

void dfs(vector<string> &ans, int N, int i, int c, vector<int> &cur) {
  if (i == N) {
    string ss;
    for (auto p: cur) {
      ss += ('a' + (char) p);
    }
    ans.push_back(ss);
    return;
  }

  int m = min(c + 1, N - 1);
  for (int k = 0; k <= m; k++) {
    cur[i] = k;
    dfs(ans, N, i+1, max(k, c), cur);
  }
}

int main() {
  int N;
  cin >> N;
  vector<int> cur(N);
  vector<string> ans;
  dfs(ans, N, 0, -1, cur);

  sort(ans.begin(), ans.end());

  for (auto s: ans) {
    cout << s << endl;
  }

  return 0;
}


Measured memory_bytes: 9588
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
    auto val = table(args...);
    return vector<decltype(val)>(n, move(val));
}
const ll INF = 1e16;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200005;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin >> a >> b;
    int c = 0;
    rep(i,a,b+1){
        string s = to_string(i);
        if (s[0] == s[4] && s[1] == s[3]) c++;
    }
    PRINT(c);
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){

  int n,ii;
  int prime[] = {
	11,
	31,
	41,
	61,
	71,
	101,
	131,
	151,
	181,
	191,
	211,
	241,
	251,
	271,
	281,
	311,
	331,
	401,
	421,
	431,
	461,
	491,
	521,
	541,
	571,
	601,
	631,
	641,
	661,
	691,
	701,
	751,
	761,
	811,
	821,
	881,
	911,
	941,
	971,
	991,
	1021,
	1031,
	1051,
	1061,
	1091,
	1151,
	1171,
	1181,
	1201,
	1231,
	1291,
	1301,
	1321,
	1361,
	1381,
	1451,
	1471,
	1481,
	1511,
	1531,
	1571,
	1601,
	1621,
	1721,
	1741,
	1801,
	1811,
	1831,
	1861,
	1871,
	1901,
	1931,
	1951,
	2011,
	2081,
	2111,
	2131,
	2141,
	2161,
	2221,
	2251,
	2281,
	2311,
	2341,
	2351,
	2371,
	2381,
	2411,
	2441,
	2521,
	2531,
	2551,
	2591,
	2621,
	2671,
	2711,
	2731,
	2741,
	2791,
	2801,
	2851,
	2861,
	2971,
	3001,
	3011,
	3041,
	3061,
	3121,
	3181,
	3191,
	3221,
	3251,
	3271,
	3301,
	3331,
	3361,
	3371,
	3391,
	3461,
	3491,
	3511,
	3541,
	3571,
	3581,
	3631,
	3671,
	3691,
	3701,
	3761,
	3821,
	3851,
	3881,
	3911,
	3931,
	4001,
	4021,
	4051,
	4091,
	4111,
	4201,
	4211,
	4231,
	4241,
	4261,
	4271,
	4391,
	4421,
	4441,
	4451,
	4481,
	4561,
	4591,
	4621,
	4651,
	4691,
	4721,
	4751,
	4801,
	4831,
	4861,
	4871,
	4931,
	4951,
	5011,
	5021,
	5051,
	5081,
	5101,
	5171,
	5231,
	5261,
	5281,
	5351,
	5381,
	5431,
	5441,
	5471,
	5501,
	5521,
	5531,
	5581,
	5591,
	5641,
	5651,
	5701,
	5711,
	5741,
	5791,
	5801,
	5821,
	5851,
	5861,
	5881,
	5981,
	6011,
	6091,
	6101,
	6121,
	6131,
	6151,
	6211,
	6221,
	6271,
	6301,
	6311,
	6361,
	6421,
	6451,
	6481,
	6491,
	6521,
	6551,
	6571,
	6581,
	6661,
	6691,
	6701,
	6761,
	6781,
	6791,
	6841,
	6871,
	6911,
	6961,
	6971,
	6991,
	7001,
	7121,
	7151,
	7211,
	7321,
	7331,
	7351,
	7411,
	7451,
	7481,
	7541,
	7561,
	7591,
	7621,
	7681,
	7691,
	7741,
	7841,
	7901,
	7951,
	8011,
	8081,
	8101,
	8111,
	8161,
	8171,
	8191,
	8221,
	8231,
	8291,
	8311,
	8431,
	8461,
	8501,
	8521,
	8581,
	8641,
	8681,
	8731,
	8741,
	8761,
8821,
8831,
8861,
8941,
8951,
8971,
9001,
9011,
9041,
9091,
9151,
9161,
9181,
9221,
9241,
9281,
9311,
9341,
9371,
9391,
9421,
9431,
9461,
9491,
9511,
9521,
9551,
9601,
9631,
9661,
9721,
9781,
9791,
9811,
9851,
9871,
9901,
9931,
9941,
10061,
10091,
10111,
10141,
10151,
10181,
10211,
10271,
10301,
10321,
10331,
10391,
10501,
10531,
10601,
10631,
10651,
10691,
10711
  };
  
  cin >> n;
  vector<int> out;
  int primeNum = sizeof(prime)/sizeof(int);
  out.resize(n);
  
  for(ii=1;ii<=n;ii++){
	out[ii-1] = prime[primeNum-ii];
  }

  for(ii=0;ii<n;ii++){
	cout << out[ii] << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
int main(){
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  long  n;unsigned long tmp; long m=0;
  std::cin >> n;
  std::vector<std::pair<unsigned long,unsigned long> > ls(n+1);
  std::vector<unsigned long long> ans(n);
  for(long i=0; i<n; ++i) {std::cin >> tmp;ls[i]=(std::make_pair(tmp,i));}
  ls[n]=(std::make_pair(0,n));
  std::stable_sort(ls.begin(),ls.end(),[](auto a,auto b){return a.first>b.first;});
  auto target=ls.begin();
  for(auto it=ls.begin();it!=ls.cend()-1;){
    if(target->second>it->second)target=it;
    ans[target->second]+=(it->first-(++it)->first)*(++m);
  }
  for(auto x : ans) std::cout<< x <<'\n';
  std::cout.flush();
  return 0;
}

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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

struct Card { char suit; int val;};

void bubbleSort(vector<Card> &A, int N){
    for(int i=0; i<N; i++){
        for(int j=N-1; j>i; j--){
            if(A[j].val < A[j-1].val) swap(A[j], A[j-1]);
        }
    }
    rep(i,N){
        cout << A[i].suit << A[i].val;
        if(i != N-1) cout << " ";
    }cout << endl;
}

void selectSort(vector<Card> &A, int N){
    for(int i=0; i<N; i++){
        int minj = i;
        for(int j=i+1; j<N; j++){
            if(A[minj].val > A[j].val) minj = j;
        }
        swap(A[i], A[minj]);
    }
    rep(i,N){
        cout << A[i].suit << A[i].val;
        if(i != N-1) cout << " ";
    }cout << endl;
}

bool isStable(vector<Card> A, vector<Card> B, int N){
    bool isSt = true;
    rep(i,N){
        if(A[i].val == B[i].val && A[i].suit != B[i].suit) isSt = false;
    }
    return isSt;
}

int main()
{
    int N; cin >> N;
    vector<Card> A(N), B(N);
    rep(i,N) cin >> A[i].suit >> A[i].val;
    rep(i,N) B[i] = A[i];
    bubbleSort(A, N);
    cout << "Stable" << endl;
    selectSort(B, N);
    if(isStable(A, B, N)) cout << "Stable" << endl;
    else cout << "Not stable" << endl;
}


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

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    for(int i = 0; i < n / 2; i++){
        if(s[i] != s[n / 2 - 1 - i] || s[i] != s[n / 2 + 1 + i] || s[i] != s[n - 1 - i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author aakas
 */
public class Main {
    static int n;
    static int n1=0;
    static int n2=0;
    static int n3=0;
    static boolean[][][] v;
    static double[][][] dp;
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        v = new boolean[n+1][n+1][n+1];
        dp = new double[n+1][n+1][n+1];
        for(int i=0;i<n;i++)
        {
            int temp = sc.nextInt();
            if(temp==1)
                n1++;
            else if(temp==2)
                n2++;
            else if(temp==3)
                n3++;
        }
        System.out.println(s(n1,n2,n3));
    }
    public static double s(int i,int j,int k)
    {
        int l = n - (i+j+k);
        if(i==0&&j==0&&k==0)
            return 0;
        if(i<0 || j<0 || k<0)
            return 0;
        if(v[i][j][k])
            return dp[i][j][k];
        v[i][j][k] = true;
        return dp[i][j][k] = (n/(double)(n-l))*(1 + (i/(double)n)*s(i-1,j,k) + (j/(double)n)*s(i+1,j-1,k) + (k/(double)n)*s(i,j+1,k-1));
    }
}


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

int main(){
	
	int i, n, x, tmp, pos = 0, cnt = 1;
	
	scanf("%d %d", &n, &x);
	
	for(i = 0; i < n; i++){
		scanf("%d", &tmp);
		pos += tmp;
		if(pos <= x)
			cnt++;
		else
			break;
	}
	
	
	printf("%d", cnt);
	
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <climits>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <complex>
#include <functional>
#include <utility>
#include <iterator>

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define dprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define dprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

int main() {
  int a, b;
  cin >> a >> b;
  cout << 6 - a - b << endl;

  return 0;
}


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

const vector<char> AsignVec = {'a', 'b', 'c', 'n'};
const int BigMp = 10000;

int calcMp(vector<int> lenVec, vector<char> bambooAsignVec, vector<int> goalLenVec)
{
    int mp = 0;

    vector<int> finalLenVec(3, 0);

    for (int i = 0; i < lenVec.size(); ++i)
    {
        for (int j = 0; j < 3; ++j)
        {
            if (bambooAsignVec.at(i) == AsignVec.at(j))
            {
                if (finalLenVec.at(j) != 0)
                {
                    mp += 10;
                }

                finalLenVec.at(j) += lenVec.at(i);
            }
        }
    }

    bool isZero = false;

    for (int i = 0; i < 3; ++i)
    {
        if (finalLenVec.at(i) == 0)
        {
            isZero = true;
            break;
        }

        mp += abs(finalLenVec.at(i) - goalLenVec.at(i));
    }

    if (isZero)
    {
        return BigMp;
    }
    else
    {
        return mp;
    }
}

int getLeastMp(vector<int> lenVec, vector<char> bambooAsignVec, vector<int> finalLenVec)
{
    if (bambooAsignVec.size() == lenVec.size())
    {
        return calcMp(lenVec, bambooAsignVec, finalLenVec);
    }
    else
    {
        int leastMp = BigMp;

        for (const char &singleNewAsign : AsignVec)
        {
            vector<char> newBambooAsignVec(bambooAsignVec.size());
            copy(bambooAsignVec.begin(), bambooAsignVec.end(), newBambooAsignVec.begin());
            newBambooAsignVec.push_back(singleNewAsign);

            int singleLeastMp = getLeastMp(lenVec, newBambooAsignVec, finalLenVec);

            leastMp = min(leastMp, singleLeastMp);
        }

        return leastMp;
    }
}

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

    vector<int> lenVec;
    for (int i = 0; i < n; ++i)
    {
        int input;
        cin >> input;
        lenVec.push_back(input);
    }

    int leastMp = getLeastMp(lenVec, {}, {a, b, c});

    cout << leastMp << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
#define ll long long
#define ld long double
int main()
{
    ll n,a,b;
    cin >> n >> a >> b;
    ll dif=b-a;
    ll ans;
    if(dif%2==0)
        ans=dif/2;
    else
    {
        ll ans1=min(b-1,n-a);
        ll ans2=((b-a)-1)/2+a;
        ll ans3=(n-(n-b+1+a))/2+n+1-b;
        ll x=min(ans1,ans2);
        ans=min(x,ans3); 
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include <cstdio>
#include <queue>
#include <algorithm>

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

using namespace std;

int a, b, c, d, p;

int main(){
	scanf("%d%d%d%d%d", &a, &b, &c, &d, &p);
	int x = p * a;
	int y = b + max(p - c, 0) * d;
	printf("%d\n", min(x, y));
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>

void op_print(char *str, int a, int b)
{
	for(int i = a; i <= b; ++i)
	{
		putchar(str[i]);
	}
	putchar('\n');
}

void op_replace(char *str, int a, int b, char *p)
{
	for(int i = a; i <= b; ++i)
	{
		str[i] = p[i - a];
	}
}

void op_reverse(char *str, int a, int b)
{
	for(; a < b; ++a, --b)
	{
		char temp;
		temp   = str[a];
		str[a] = str[b];
		str[b] = temp;		
	}
}

int main()
{
	int q, a, b;
	char str[1024], p[1024], op[16];

	scanf("%s %d", str, &q);
	for(int i = 0; i < q; ++i)
	{
		scanf("%s %d %d", op, &a, &b);

		if(strcmp(op, "print") == 0)
		{
			op_print(str, a, b);
		}
		if(strcmp(op, "reverse") == 0)
		{
			op_reverse(str, a, b);
		}
		if(strcmp(op, "replace") == 0)
		{
			scanf("%s", p);
			op_replace(str, a, b, p);
		}
	}
	return 0;
}


Measured memory_bytes: 2116