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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    vector<int> rate(8, 0);
    int free = 0;
    sort(a.begin(), a.end());
    for(int i=0; i<n; i++){
        if(a[i]<3200){
            if(a[i]<400){
                rate[0]++;
            }else if(a[i]<800){
                rate[1]++;
            }else if(a[i]<1200){
                rate[2]++;
            }else if(a[i]<1600){
                rate[3]++;
            }else if(a[i]<2000){
                rate[4]++;
            }else if(a[i]<2400){
                rate[5]++;
            }else if(a[i]<2800){
                rate[6]++;
            }else if(a[i]<3200){
                rate[7]++;
            }
        }else{
            free++;
        }
    }
    int ans = 0;
    for(int i=0; i<8; i++){
        if(rate[i]>0){
            ans++;
        }
    }
    if(ans == 0){
        cout << 1 << ' ';
    }else{
        cout << ans << ' ';
    }

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

Measured memory_bytes: 256
import java.util.Scanner;

class Main
{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		int[] a = new int[300];
		int[] b = new int[300];
		int i = 0;
		
		a[0] = 1;
		b[0] = 1;
		
		int c = 1;
		
		while(!(a[i] == 0 && b[i] == 0)){
			i++;
			a[i] = scan.nextInt();
			b[i] = scan.nextInt();}
			
		for(int q=1; q<i; q++){
		for(int j=0; j<a[q]; j++){
			if(j%2==0){
				c = 0;}
			else if(j%2==1){
				c = 1;}
		for(int h=0; h<b[q]; h++){
			if(c==0){
				System.out.print("#");
				c = 1;}
			else if(c==1){
				System.out.print(".");
				c = 0;}}
				System.out.print("\n");}
				System.out.print("\n");}
	}
}


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

int main() {
	// your code goes here
	int n;
	cin>>n;
	int a[2*n];
	for(int i=0;i<2*n;i++){
		cin>>a[i];
	}
	sort(a,a+2*n);
	int sum=0;
	for(int i=0;i<2*n;i+=2){
		sum+=a[i];
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
*x, = map(float, input().split())
*y, = map(float, input().split())

d = [0]*4
d[0] = sum(abs(a - b) for a, b in zip(x, y)) # manhattan
d[1] = (sum((a - b)**2 for a, b in zip(x, y)))**0.5 # euclid
d[2] = (sum(abs(a - b)**3 for a, b in zip(x, y)))**(1/3) # 
d[3] = max(abs(a - b) for a, b in zip(x, y)) # chebyshev

for i in range(4):
    print("%.6f" % d[i])


Measured memory_bytes: 5668
N, M = map(int, input().split())
X = sorted(list(map(int, input().split())))
difX = [0]
for i in range(1, M):
    difX.append(X[i]-X[i-1])
difX.sort(reverse=True)
print(max(X) - min(X) - sum(difX[:N-1]))

Measured memory_bytes: 13968
import java.util.Scanner;

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

		int r = scan.nextInt();
		int c = scan.nextInt();

		int[][] table = new int[r][c + 1];

		for(int i = 0; i < r; i++) {
			int sum = 0;
			for(int j = 0; j < c; j++) {
				table[i][j] = scan.nextInt();
				sum += table[i][j];
			}
			table[i][c] = sum;
		}

		for(int i = 0; i < r; i++) {
			for(int j = 0; j < c + 1; j++) {
				if(j != 0) {
					System.out.printf(" ");
				}
				System.out.printf(table[i][j] + "");
			}
			System.out.println();
		}

		for(int i = 0; i < c + 1; i++) {
			int sum = 0;
			for(int j = 0; j < r; j++) {
				sum += table[j][i];
			}
			if(i != 0) {
				System.out.printf(" ");
			}
			System.out.printf(sum + "");
		}
		System.out.println();

		scan.close();
	}
}


Measured memory_bytes: 52332
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
#define DEBUG_PRINT(var) std::cout << #var << " = " << var << "\n";

const int MX = 1e6;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    ssort(a);
    vector<pint> azip(1, pint(a[0], 0));
    for (int p : a) {
        if (azip.back().first == p) {
            azip.back().second ++;
            }
        else {
            azip.emplace_back(p, 1);
        }
    }
    vector<bool> check(MX+1, false);
    int ans = 0;
    for (auto el : azip) {
        if (!check[el.first]) {
            if (el.second == 1) {
                ans ++;
            }
            int ai = el.first;
            rep (i, MX / ai + 1) {
                check[ai*i] = true;
            }
        }
    }
    cout << ans << "\n";
    return 0;
}


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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define int long long
#define pii pair<int, int>
#define ff first
#define ss second
#define MP make_pair
#define PB emplace_back
#define all(x) (x).begin(), (x).end()
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

int32_t main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    IOS;
    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    vector<int> A(a), B(b), C(c);
    for (int i = 0; i < a; i++) cin >> A[i];
    for (int i = 0; i < b; i++) cin >> B[i];
    for (int i = 0; i < c; i++) cin >> C[i];
    sort(all(A), greater<int>());
    sort(all(B), greater<int>());
    sort(all(C), greater<int>());
    vector<int> ans;
    for (int i = 0; i < x; i++) ans.PB(A[i]);
    for (int i = 0; i < y; i++) ans.PB(B[i]);
    sort(all(ans));
    int idx = 0;
    for (int i = 0; i < min(c, x + y); i++)
    {
        if (idx == (int)ans.size()) break;
        if (ans[idx] < C[i]) ans[idx++] = C[i];
    }
    int sum = 0;
    for (int i = 0; i < (int)ans.size(); i++)
    {
        sum += ans[i];
    }
    cout << sum << "\n";
    return 0;
}

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

int main(void){
  int n,k;
  
  cin >> n >> k;
  for (int i=0; i<n; i++){
    int t; cin >> t;
  }
  cout << (n-1+(k-2))/(k-1) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
    int N,N2;
    int X;

    cin >> N;
    X = N / 1.08;
    if((X*1.08) == N) {
        cout << X << endl;
    }else {
        X++;
        N2 = X*1.08;
        if(N2 == N) {
            cout << X << endl;
        }else {
            cout << ":(" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define pi acos(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
#define N 200005
#define rank Rank
#define index Index
LL dp[1000005];
int mod=1e9+7;
LL fra[1000005];
int main(){
    int n,h,d;
    scanf("%d %d %d",&n,&h,&d);
    fra[0]=1;
    LL ssum=0;
    for(int i =1;i<=n;i++){
        fra[i]=fra[i-1]*i%mod;
        ssum+=fra[i];
        ssum%=mod;
    }
    dp[0]=fra[n];
    queue<LL> q;
    LL sum=dp[0];
    q.push(dp[0]);
    for(int i=1;i<h;i++){
        //for(int k = 0;k<n;k++)
        dp[i]=sum*ssum%mod;
        q.push(dp[i]);
        sum+=dp[i];
        if(q.size()>d){
            sum-=q.front();
            q.pop();
        }
        sum = (sum%mod+mod)%mod;
        /*for(int j=1;j<=d;j++){
            if(i-j>=0){
                dp[i]+=dp[i-j]*sum;
                dp[i]%=mod;
            }
        }*/
    }
    LL ans=0;
    for(int j=1;j<=d;j++){
        if(h-j>=0){
            ans+=dp[h-j];
            ans%=mod;
        }
    }
    printf("%lld\n",ans);
    return 0;
}

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

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

const ld Pi = 3.14159265359;
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll N = 2e5 + 10;
const ll INF = 1e18;
const ll LOG = 20;
ll n, k;
ld ans = 0;
int main(){
	IOS;
	cin >> n >> k;
	for (int i = 1; i <= n; i++){
		ld Now = (1.0 / n);
		ll Wow = i;
		while (Wow < k){
			Wow *= 2;
			Now *= 0.5;
		}
		ans += Now;
		
	}
	
	cout << fixed << setprecision(20) << ans;
	
	
	
	
	
	return 0;
}






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




Measured memory_bytes: 256
// In the name of God

#include <bits/stdc++.h>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int h1, m1, h2, m2, k;	
	cin >> h1 >> m1 >> h2 >> m2 >> k;
	int x = h1*60+m1;
	int y = h2*60+m2;
	cout << y-x-k;
	return 0;
}


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

using namespace std;
using nagai = long long;
#define sz(x) int((x).size())

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b&&b==c)
		cout<<"Yes\n";
	else
		cout<<"No\n";
	return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    int ans = 0;
    switch(str) {
      case "SUN":
        ans = 7;
        break;
      case "MON":
        ans = 6;
        break;
      case "TUE":
        ans = 5;
        break;
      case "WED":
        ans = 4;
        break;
      case "THU":
        ans = 3;
        break;
      case "FRI":
        ans = 2;
        break;
      case "SAT":
        ans = 1;
        break;
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 23124
/*
Pradyumn Sinha 
Delhi Technological University
*/
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> OST;
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii >
#define vll vector<pll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pi 3.14159265358979
#define EL printf("\n")
#define OK printf("OK");
#define foreach(i,t) for(auto i =t.begin();i!=t.end();i++) 
#define pdn(n) printf("%d\n",n)
#define pln(n) printf("%lld\n",n)
#define psn(n) printf("%s\n",n)
#define pcn(n) printf("%c\n",n)
#define sl(n) scanf("%lld",&n)
#define sd(n) scanf("%d",&n)
#define ss(n) scanf("%s",&n)
#define pn printf("\n")
#define  omap unordered_map
#define SZ(x) ((int)(x.size()))
#define foi(i,a,n) for(int (i)=int(a);(i)<=int(n);++(i))
#define fod(i,a,n) for(int (i)=int(a);(i)>=int(n);--(i))
#define PI 3.14159265
#define inf 1e18
#define mod 1000000007
#define precise(n,k) fixed<<setprecision(k)<<n
#define DBG(c) cout << #c << " = " << c << endl;
#define RTIME ((double)clock()/(double)CLOCKS_PER_SEC)
#define fequal(a,b) (fabs(a - b)<(1e-9))
int toint(const string &s) { stringstream ss; ss << s; int x; ss >> x; return x; }
string tostring ( int number ){  stringstream ss; ss<< number; return ss.str();}

typedef long long ll;
typedef long double lf;

ll pw(ll a,ll b) 
{if(b==0) return 1; if(b==1) return a;  ll ans=pw(a,b/2); if(b&1) 
return (((ans*ans)%mod*a)%mod); 
 return (ans*ans)%mod; }	
ll gcd(ll a,ll b){return (b==0)? a:gcd(b,a%b); }
void nope(int dec = 0){if(!dec) cout<<"NO"<<endl;else cout<<"YES"<<endl;exit(0);}

int cnt[10100];
int arr[120][120];
int child[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
int n;
int h,w;
bool valid(int x,int y)
{
	return (x>=1&&x<=h&&y>=1&&y<=w&&!arr[x][y]);
}
void color(int x,int y,int &col)
{
	if(arr[x][y])
		return;
	if(!cnt[col])
		col++;
	if(col>n)
		return;
	arr[x][y]=col;
	cnt[col]--;
	for(auto ch:child)
	{
		int nx=x+ch[0];
		int ny=y+ch[1];
		if(!valid(nx,ny))
			continue;
		color(nx,ny,col);
		if(col>n)
			continue;
	}

}
int main()
{
	
	sd(h);sd(w);
	sd(n);
	for(int i=1;i<=n;i++)	
		sd(cnt[i]);
	int col=1;
	color(1,1,col);
	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<=w;j++)
			printf("%d ",arr[i][j]);
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 896
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;
	
	public static void Main(string[] args)
	{
		var p = Console.ReadLine();
		Console.WriteLine(p.Contains("7")?"Yes":"No");
	}

	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}

Measured memory_bytes: 17460
#include<stdio.h>
int main()
{
	int i,j,n,a[5][105]={0};
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		scanf("%d",&a[1][i]);
	for(i=1;i<=n;i++)
		scanf("%d",&a[2][i]);
	int maxx=0;
	for(i=1;i<=n;i++)
	{
		int sum=0;
		for(j=1;j<=i;j++)
			sum+=a[1][j];
		for(j=i;j<=n;j++)
			sum+=a[2][j];
		if(sum>maxx)
			maxx=sum;
	}
	printf("%d",maxx);
	return 0;
}

Measured memory_bytes: 128
if __name__ == '__main__':
    N, K = map(int, input().split())
    H = list(map(int, input().split()))
    H = sorted(H)[::-1]
    cnt = 0
    for h in H:
        if K>0:
            K -= 1
        else:
            cnt += h
    
    print(cnt)

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

int main()
{
    long N,M;
    cin >> N >> M;
    long a[M];
    for(long i=0;i<M;i++){
        cin >> a[i];
    }
    for(int i=1;i<M;i++){
        a[0]+=a[i];
    }
    if(a[0]>N)cout << "-1" << endl;
    else{
        cout << N-a[0] << endl;
    }
}

Measured memory_bytes: 3688
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


	string S;
	cin >> S;

	int a = 0;
	int kotae = 0;
	rep(i, 3) {
		if (S[i] == 'R') {
			a++;
		}
		else a = 0;

		chmax(kotae, a);
	}
	co(kotae);



	Would you please return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int c = sc.nextInt();
		int[] arrayb=new int[m];
		int[] arraya=new int[m];
		for(int i=0;i<m;i++) {
			arrayb[i]=sc.nextInt();
		}
		int count=0,count1=0;
		for(int j=0;j<n;j++) {
			for(int i=0;i<m;i++) {
				count+=sc.nextInt()*arrayb[i];
			}
			count+=c;
			if(count>0) {
				count1++;
			}
			count=0;
		}
		System.out.println(count1);
	}
}

//Arrays.sort(array, (a, b) -> Integer.compare(a[0], b[0]));




Measured memory_bytes: 23380
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
#include<stack>
using namespace std;
#define int long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dup(x,y) (((x)+(y)-1)/(y))
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;
const long double PI = (acos(-1));


signed main() {
	int N, M;
	cin >> N >> M;
	vector<P>v(M);
	rep(i, M) {
		int a, b;
		cin >> a >> b;
		v[i] = { b,a };
	}
	sort(v.begin(), v.end());
	double place;
	int ans = 1;
	rep(i, M) {
		if (!i)place = v[i].first - 0.5;
		else {
			if (v[i].second <= place && place <= v[i].first)continue;
			place = v[i].first - 0.5;
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 4848
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back
#define eb emplace_back
#define mod  1000000007
#define PI 2*acos(0.0)
#define maxn 10000005

int32_t main()
{
    io;
    int n;
    cin>>n;
    ll ans = 0;
    vi din(n+1, 1);
    for(int i = 2; i <=n; i++)
        for(int j = i; j <=n; j+= i)
            din[j]++;
    for(int i = 1; i<=n; i++)
        ans += 1LL*i*din[i];
    cout<<ans;
    return 0;
}

Measured memory_bytes: 42272
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define REP_AB(i, a, b) for (ll i = ll(a); i < ll(b); i++)
#define REP_IN(i, n, x) for (ll i = 0; i < n; i++)in>>x;
#define REP_OUT(i, n, x) for (ll i = 0; i < n; i++)out<<x<<endl;
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
#define REVERSE(v) reverse(ALL(v))
// true / false
#define BIN_SEARCH(v, a) binary_search(ALL(v), a)
// index
#define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin())
#define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin())
#define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a))
#define DEL(v, i) v.erase(v.begin() + i)
#define INSERT(v, i, a) v.insert(v.begin() + i, a)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a / gcd(a, b)) * b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
#define endl '\n'
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
// template end
 
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll N, ans = 0;
    in >> N;

   REP(i, N){
       ans += N-i-1;
   }
    
    out << ans << endl;


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back

using namespace std;
ll a;
void input();

void solve(){
    cout<<a+a*a+a*a*a<<"\n";
}

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

    input();
    solve();

}

void input(){
    cin>>a;
}


Measured memory_bytes: 3644
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#pragma GCC optimize(2)
#include<map>
#include<set>
#include<cstdio>
#include<string>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N=5010;
ll dist[N][N],circle[N],mark[N];
bool st[N];
int pos[N],n;
ll k;
int main()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++) cin>>pos[i];
    for(int i=1;i<=n;i++) cin>>mark[i];
    for(int i=1;i<=n;i++)
    {
        memset(st,0,sizeof st);
        int j=pos[i],idx=0;
        while(!st[j])
        {
            st[j]=1;
            idx++;
            dist[i][idx]=dist[i][idx-1]+mark[j];
            j=pos[j];
        }
        circle[i]=idx;
        // dist[i][1]=mark[i];
        // int idx=1;
        // for(int j=pos[i];j!=i;j=pos[j]) 
        // {
        //     ++idx;
        //     dist[i][idx]=dist[i][idx-1]+mark[j];
        // }
        // circle[i]=idx;
        
    }
    // for(int i=1;i<=n;i++)
    // {
    //     for(int j=1;j<=circle[i];j++) cout<<dist[i][j]<<' ';
    //     cout<<endl;
    // }
    ll res=-1e18;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=circle[i];j++)
        {
             ll x=dist[i][j];
            if(k<j) break;
            if(dist[i][circle[i]]>=0) x+=(k-j)/circle[i]*dist[i][circle[i]];
            res=max(res,x);
        }
    
    cout<<res<<endl;
    return 0;
}

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

int main(){
  #define int long
  int L,R;cin>>L>>R;
  int m=INT_MAX;
  if(R/2019-L/2019>1){
    cout<<0;
  }else if(R/2019-L/2019==1){
    for(int i=L%2019;i<R%2019+2019;i++){
      for(int j=i+1;j<=R%2019+2019;j++){
        if(m>(j*i)%2019)m=(j*i)%2019;
      }
    }
    cout<<m;
  }else{
    for(int i=L;i<R;i++){
      for(int j=i+1;j<=R;j++){
        if(m>(j*i)%2019)m=(j*i)%2019;
      }
    }
    cout<<m;
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define For(i,m,n) for(int i=m;i<n;i++)
#define ll long long
#define l long
#define all(x) x.begin(),x.end()
#define pb push_back
#define len(x) x.len
int main()
{

ll n,m;
cin>>n>>m;
cout<<n*m;



return 0;}


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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int n; cin >> n;
  int t100=n/100,t10=(n/10)%10,t1=n-t100*100-t10*10;

  int ans;
  if(t100<t10){
    t100++;
    t10 = t100;
    t1 = t10;
  }
  else if(t100 == t10){
    if(t10<t1){
      t100++;
      t10=t100;
      t1=t100;      
    }
    else{
      t1 = t10;
    }
  }
  else{
    t10 = t100;
    t1 = t100;
  }

  ans = t1+t10*10+t100*100;
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3592
N,M,K=map(int,input().split())
def cmb(x,y):
  X=1
  Y=1
  for i in range(1,y+1):
    X= X*(x+1-i)%MOD
    Y= Y*i%MOD
  return (X*pow(Y,MOD-2,MOD))%MOD
MOD=10**9+7
A=cmb(M*N-2, K-2)
ans=0
for d in range(1,N):
  ans+=d*(N-d)*M*M*A%MOD
for d in range(1,M):
  ans+=d*(M-d)*N*N*A%MOD
print(ans%MOD)

Measured memory_bytes: 3064
s = input().rstrip()
n = len(s)

removed = 0
cnt_s = cnt_t = 0

for i in range(n):
    if s[i] == 'S':
        cnt_s += 1
    else:
        cnt_t += 1
    if i == n-1:
        removed += min(cnt_s,cnt_t)
    elif cnt_t > cnt_s:
        removed += cnt_s
        cnt_s = cnt_t = 0
#     print(cnt_s,cnt_t)
print(len(s) - removed*2)

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

typedef long long int ll;

int main()
{
    ll h;
    cin >> h;

    bool f = false;

    ll ans = 0;
    for(ll i = 1;;i *= 2){
        ans += i;
        h /= 2;
        if(h < 1){
            break;
        }
    }

    cout << ans;
   
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, less<>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//998244353;
const int base = 2187;
const double eps = 1e-8;
const int N = 100'000;
const int LOGN = 18;

int n, m, k;

void solve(int test)
{
  cin >> n;
  vector<int64> a(n + 1);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int sign = 1;
  vector<int64> b(n, 0);
  for (int i = 0; i < n; ++i) {
    b[0] += a[i] * sign;
    sign *= -1;
  }
  for (int i = 1; i < n; ++i) {
    b[i] = a[i - 1] * 2 - b[i - 1];
  }
  for (auto val : b) {
    cout << val << ' ';
  }
  cout << '\n';
}

void precalc()
{
}

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i)
    solve(i);
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
#include <cstdlib> 
using namespace std;
int main(int argc, char const *argv[])
{
	long n,x,steps,temp;
	cin>>n>>steps;
	vector<long> v(n);
	vector<long> dp(n,INT_MAX);
	for(int i=0;i<n;i++){

		cin>>v[i];
	}
	dp[0]=0;
	for (int i=0;i<n+1; ++i){
		for(int j=i+1;j<=i+steps;++j){
			if(j<n){
				dp[j]=min(dp[j],dp[i]+abs(v[i]-v[j]));
			}
		}
	}
	cout<<dp[n-1]<<"\n";
	return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

const int N = 110;
const int INF = 0x3f3f3f3f;

int n, ans;
int b[N];

int main(){
    scanf("%d", &n);
    for (int i = 1; i < n; i ++ )
        scanf("%d", &b[i]);
    b[0] = INF, b[n] = INF;
    for (int i = 1; i <= n; i ++ )
        ans += min(b[i], b[i - 1]);
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
import sys

readline = sys.stdin.buffer.readline

ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))

def solve():
  s = [x - 97 for x in ns()]
  n = len(s)
  c = 0
  g = {0:0}
  for x in s:
    c ^= 1 << x
    y = g.get(c, n) + 1
    for i in range(26):
      y = min(y, g.get(c ^ (1 << i), n) + 1)
    g[c] = min(g.get(c, n), y)
  print(y)
  return

solve()


Measured memory_bytes: 34372
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define sayyes cout<<"Yes"<<endl;
#define sayno cout<<"No"<<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const int mod =1e9+7;

int main()
{
    int n,m;
    cin>>n>>m;
    vector<string>a(n);
    vector<string>b(m);
    rep(i,n)
    {
        cin>>a[i];
    }
    rep(i,m)
    {
        cin>>b[i];
    }
    rep(i,n-m+1)
    {
        rep(j,n-m+1)
        {
            bool flag=true;
            rep(k,m)
            {
                rep(l,m)
                {
                    if(a[i+k][j+l]!=b[k][l])flag=false;
                }
            }
            if(flag)
            {
                sayyes;
                return 0;
            }
        }
    }
    sayno;
}

Measured memory_bytes: 256
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
import math
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math as M
MOD=10**9+7
import random
#####################################
n=int(input())
A=INPUT()
D=[0]*(n+1)
for i in range(n):
    D[A[i]]=(i+1)
print(*D[1:])


Measured memory_bytes: 99288
#include <iostream>

using namespace std;

int main(){
    int N;
    cin >> N;
    int a[200000];
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }
    for(int i = 0; i < N; i++){
        if(N - 2*i > 0) cout << a[N - 2*i-1] << ' ';
        else{
            cout << a[N-1-2*(N-i-1)-1];
            if(i != N-1) cout << ' ';
            else cout << endl;
        }
    }
}

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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP0(i,n) for (ll i = 0; i <= (ll)(n); ++i)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}

signed main() 
{
  int n,l; cin>>n>>l;
  string s[n]; 
  rep(i,n) cin>>s[i];
  sort(s,s+n);
  string ans="";
  rep(i,n) ans+=s[i];
  print(ans);  

  return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define int ll

const ll MOD = 1000000007;
const ll INF_LL = (ll)1000000007 * 1000000007;
const int INF_INT = (int)1000000007;
const double PI = 3.14159265358979323846;

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)

#define m0(x) memset((x), 0, sizeof((x)))
#define m1(x) memset((x), -1, sizeof((x)))

// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define RALL(x) (x).rbegin(), (x).rend()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())     // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))  //最大値を求める
#define MIN(x) *min_element(ALL(x))  //最小値を求める
#define all(x) (x).begin(), (x).end()

//略記
#define pb emplace_back  // vectorヘの挿入
#define mp make_pair     // pairのコンストラクタ
#define F first          // pairの一つ目の要素
#define S second         // pairの二つ目の要素

#define BITCOUNT __builtin_popcount
#define BITCOUNT_LL(x) __builtin_popcountll(x)

#define perm(c)             \
  sort(all(c));             \
  for (bool c##p = 1; c##p; \
       c##p = next_permutation(all(c)))  //順列 123 132 213 231 312 321

#define BIT(n) (1LL << (n))

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ": " << (A) << std::endl;
#else
#define PRINT(A)
#endif

//入力高速化
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

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

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

  int Rcount = 0;
  rep(i, N) {
    if(S[i] == 'R') Rcount ++;
  }
  int ans = 0;
  rep(i, N-Rcount) {
    if(S[i+Rcount] == 'R') ans ++;
  }
  cout << ans << endl;
  PRINT(Rcount)
}

Measured memory_bytes: 3684
#include<stdio.h>
int main()
{
	int a,b,c,d,e,f,r;
	scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
	r=a+b*5+c*10+d*50+e*100+f*500;
	if(r>=1000){
		printf("1\n");
	}else{
		printf("0\n");
	}
	return 0;
}

Measured memory_bytes: 2696
import math
N=int(input())
P=list(map(int, input().split()))
Q=list(map(int, input().split()))
a=b=1
l=[i for i in range(1,N+1)]
m=[i for i in range(1,N+1)]
for i in range(N):
  #print("===P[i]===", P[i])
  #print(l.index(P[i]), math.factorial(N-i-1))
  if N-i-1 < 0:
    pass
  else:
    a += l.index(P[i])*math.factorial(N-i-1)
  #print("l", l)
  if not i==N-1:
    l.pop(l.index(P[i]))
for i in range(N):
  if N-i-1 < 0:
    pass
  else:
    b += m.index(Q[i])*math.factorial(N-i-1)
  if not i==N-1:
    m.pop(m.index(Q[i]))
print(abs(a-b))


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

static void SolveA()
{
	int n, k;
	std::string s;
	std::cin >> n >> k;
	std::cin >> s;

	s[k - 1] = std::tolower(s[k - 1]);

	std::cout << s;
}

int main()
{
	SolveA();
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(void){
	int n;cin >> n;
	vector<int>a(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	int MAX = -2002002000;
	int MIN = 1001001000;
	for(int i=0;i<n;i++){
		if(i>0)MAX = max(MAX,a[i]-MIN);
		MIN = min(MIN,a[i]);
	}
	cout << MAX << endl;
	return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

using namespace std;

#define eps 1e-9
#define M 256
#define max 16

/*
	線形合同法は以下の公式によって擬似乱数である級数Rを生成する。
	ただしS,A,C,Mは全て媒介変数である。

		R[0] = S, R[i] = ( A * R[ i - 1 ] + C ) % M

	この問題において、0 <= S, A, C <= 15, M = 256である。
	さて、いくつかデータが入力されるとして、データの各要素は
	0以上M - 1以下の整数であるとする。
	ここで、擬似乱数の級数R[]を用いると、以下の公式の出力として
	別の級数O[]を得る。

		O[i] = (I[i] + R[i]) % M

	Oの情報エントロピーが最小となるような媒介変数S,A,Cを表示するプログラムを書け。
	ここで、情報エントロピーHは次の式によって与えられる。

		H = - Σ_{x} ( #(x) / N ) log { #(x) / N }

	ただしNはデータの個数であり、#(x)は要素xの出現回数である。

	入力
	入力は複数のデータセットからなる。
	各データセットは以下の形式を持つ。

	Nは256以下である。
	最後のデータセットは1つの0からなる。
	この行は決してデータセットではなく、処理を行ってはならない。

	出力
	各データセットについて、三個の媒介変数S,A,Cを一文字の空白で区切り出力せよ。
	最小のエントロピーを実現する方法が2通り以上ある場合、S,A,そしてCが最小となるものを選べ。

*/

struct param{
	int S, A, C;
	vector< int > O;
	vector< int > R;
	vector< int > oc;
	double H;
	bool operator < ( const param& right ) const {
		return ( H == right.H ? 
					( S == right.S ? (
						( A == right.A ) ?
						C < right.C :
						A < right.A 
					) : S < right.S ) :
					H + eps < right.H  );
	}
};

void solve( int n ) {
	vector< param > p;
	vector< int > I;
	I.push_back( 0 );
	//入力
	for(int i = 0; i < n; i++) {
		int tmp;
		cin >> tmp;
		I.push_back( tmp );
	}

	//初期化
	param np;
	for(int i = 0; i < M; i++)
		np.oc.push_back( 0 );
		np.H = 0.0;

	for(int S = 0; S < max; S++) {
		for(int A = 0; A < max; A++) {
			for(int C = 0; C < max; C++) {
				np.A = A;
				np.C = C;
				np.S = S;
				p.push_back( np );
			}
		}
	}
	
	//擬似乱数生成
	for(int i = 0; i < p.size(); i++) {
		for(int j = 0; j <= n; j++) {
			if( j == 0 ) {
				p[i].R.push_back( p[i].S );
				p[i].O.push_back( 0 );
			} else {
				p[i].R.push_back( ( p[i].A * p[i].R[ j - 1 ] + p[i].C ) % M );
				p[i].O.push_back( ( I[j] + p[i].R[j] ) % M );
				p[i].oc[ p[i].O[j] ] ++;
			}
			
		}
	}

	//エントロピー計算
	for(int i = 0; i < p.size(); i++) {
		for(int j = 0; j < p[i].oc.size(); j++) {
			double d = ( ( double ) p[i].oc[j] / ( double ) n);
			if( p[i].oc[j] != 0 ) p[i].H -= d * ( log ( (double)p[i].oc[j] ) - log( (double)n ) );
		}
	}
	sort( p.begin(), p.end() );
	cout << p[0].S << " " << p[0].A << " " << p[0].C << endl;
}

int main(void){
	//FILE* fp_in = freopen("data.txt", "r", stdin);
	
	int n;
	while( scanf("%d",&n), n )
		solve(n);

	//while(1){}
    return 0;
}

Measured memory_bytes: 14108
macro_rules! get_one {
    ($t:ty) => {{
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse::<$t>().unwrap()
    }};

    ($t:ty; $n:expr) => {
        (0..$n).map(|_| get_one!($t)).collect::<Vec<_>>()
    };
}

fn main() {
    let n = get_one!(String);
    if n.chars().any(|x| x == '7') {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

int main()
{
    int n,k,r,s,p;
    cin >> n >> k;
    cin >> r >> s >> p;
    int score = 0;
    vector<char> v(n,'@');
    for(int i = 0; i < n; ++i)
    {
        char c,hand;
        int sc;
        cin >> c;
        switch(c)
        {
            case 'r':
                sc = p;
                hand = 'p';
                break;
            case 's':
                sc = r;
                hand = 'r';
                break;
            case 'p':
                sc = s;
                hand = 's';
                break;
            default:
                break;
        }
        if(i >= k
        && hand == v[i-k])
        {
            continue;
        }
        score += sc;
        v[i] = hand;
    }
    cout << score << endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<stdio.h>
using namespace std;
using ll=long long;
#include<algorithm>
#include<set>
#include<vector>
#define rep(i,n) for(int i=0;i<(n);i++)
using P=pair<int,int>;

//auto

int main(){
int n;
cin>>n;
if(n>=30)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
return 0;
}



Measured memory_bytes: 3100
#include <stdio.h>

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

int main(void) {
	int i,j,k,max[3],height;

	max[0] = max[1] = max[2] = 0;
	for (i=0;i<10;i++) {
		scanf("%d",&height);
		for (j=0;j<3;j++) {
			if (max[j]<height) {
				k = 2;
				while (k>j) {
					swap(&max[k],&max[k-1]);
					k--;
				}
				max[j] = height;
				break;
			}
		}
	}
	for (i=0;i<3;i++) printf("%d\n",max[i]);

	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MOD 1000000007
#define PI 3.141592653589793
const int INF = 100000000;
int dx[] = {0,1,-1,0,1,-1,1,-1};
int dy[] = {1,0,0,-1,1,-1,-1,1};

int main(){
    int n;
    cin >> n;
    vector<double> v(n);
    for(int i = 0; i < n; i++)
        cin >> v[i];
    sort(v.begin(), v.end());
    for(int i = 1; i < n; i++){
        v[i] = (v[i] + v[i-1]) / 2;
    }
    printf("%0.5lf\n", v[n-1]);
}


Measured memory_bytes: 256
import math

def factorial(n):
    if n==1:
        return n
    else:
        return n*factorial(n-1)
    
def calc_dist(city_a, city_b):
    x_a, y_a = city_a
    x_b, y_b = city_b
    return (math.sqrt((x_b - x_a)**2 + (y_b - y_a)**2))

        
n = int(input())
fact = factorial(n)
fact_n_1 = factorial(n-1)
cities = []
for i in range(n):
    x,y = list(map(int,input().split()))
    cities.append([x,y])
    
distance_sum = 0
count=0
for i in range(n):
    for j in range(n-1-i):
        distance_sum += calc_dist(cities[j+i+1], cities[i]) * fact_n_1 * 2
        
print(distance_sum/fact)

Measured memory_bytes: 3064
# coding: utf-8

day = input().split(" ")
natsu = int(day[0])
kazu = int(day[1])
syuku = input().split(" ")
total = 0
for i in range(len(syuku)):
    total += int(syuku[i])
if natsu < total:
    print(-1)
else:
    print(natsu- total)

Measured memory_bytes: 65460
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *					# ll = deepcopy(l)
from heapq import *					# heappush(hp,x)
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from bisect import *				# bisect_left(arr,x,start,end)  => start and end parameters are temporary
from sys import stdin				# bisect_left return leftmost position where x should be inserted to keep sorted
from sys import maxsize				# minn = -maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *				# pre = [0] + list(accumulate(l))
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''

'''

def solve(l):
	n = len(l)
	

N = int(stdin.readline())
a,b = list(map(int, stdin.readline().rstrip().split()))
f = 0
for i in range(a,b+1):
	if(i%N == 0):
		f = 1
		break
if(f):
	print('OK')
else:
	print('NG')



Measured memory_bytes: 76584
S = input()
N = int((len(S)-1)/2)
flag = 0
for i in range(N):
    if S[i] != S[len(S)-1-i]:
        flag = 1

for i in range(int(N//2)):
    if (S[i] != S[N-1-i]):
        print('No')
        break
else:
    if flag == 1:
        print('No')
    else:
        print('Yes')


Measured memory_bytes: 3060
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N = 10**6
    table = [0 for _ in range(N+1)]
    prime = [True] * (N+1)
    for i in range(2, N+1):
        if not prime[i]:
            continue
        else:
            table[i] = i
            num = i + i
            while num < N:
                prime[num] = False
                table[num] = i
                num += i

    def factorize(n):
        ans = []
        while not prime[n]:
            ans.append(table[n])
            n = n // table[n]
        ans.append(n)
        return ans
    n = I()
    A = LI()
    coprime = True
    c = collections.Counter()
    memo = {}
    for a in A:
        soinsu = factorize(a)
        memo[a] = soinsu
        for s in soinsu:
            c[s] += 1
    for a in A:
        soinsu = memo[a]
        for s in soinsu:
            c[s] -= 1
        for s in soinsu:
            if s == 1:
                continue
            if c[s] > 0:
                coprime = False
                break
    def gcd(a, b):
        if b == 0:
            return a
        return gcd(b, a % b)

    if coprime:
        print("pairwise coprime")
        return

    setwise = False
    m = A[0]
    for a in A[1:]:
        m = gcd(a, m)
    if m == 1:
        setwise = True

    if setwise:
        print("setwise coprime")
        return

    print("not coprime")
    return





main()



Measured memory_bytes: 306400
#include <iostream>
#include <vector>
#include <map>


using namespace std;
typedef long long ll;
#define REP(i,n) for (int i = 0; i < n; ++i)

ll N;

int main() {
    cin >> N;
    
    ll ans = 0;
    ll left = 1;
    while (left < N) {
        ll q = N/left;
        ll ok = left, ng = N+1;
        while (ng - ok > 1) {
            ll mid = (ok + ng) / 2;
            if (N/mid == q) ok = mid;
            else ng = mid;
        }
        if ((N-q)%q == 0) {
            ll m = (N-q)/q;
            if (left <= m && m <= ok) {
                ans += m;
            }
        }
        left = ng;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256