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

int main(){
  int h,w,n; cin>>h>>w>>n;
  bool flag = true;
  int noww=0,nowh=0;
  vector<vector<int>> ans(h,vector<int>(w));
  for(int i=1;i<=n;i++){
    int a; cin>>a;
    while(a!=0){
      if(flag){
        ans[nowh][noww]=i;
        noww++;
        if(noww==w){
          noww--; nowh++;
          flag=false;
        }
      }else{
        ans[nowh][noww]=i;
        noww--;
        if(noww==-1){
          noww++; nowh++;
          flag=true;
        }
      }a--;
    }
  }for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(j!=w-1){
        cout<<ans[i][j]<<' ';
      }else{
        cout<<ans[i][j]<<endl;
      }
    }
  }
}

Measured memory_bytes: 384
//By TheOneYouWant
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i=0;i<e;++i)
#define forsn(i,s,e) for(int i=s;i<e;++i)
#define rforn(i,s) for(int i=s;i>=0;--i)
#define rforsn(i,s,e) for(int i=s;i>=e;--i)
#define bitcount(a) __builtin_popcount(a) // set bits (add ll)
#define ln '\n'
#define getcurrtime() cerr<<"Time = "<<((double)clock()/CLOCKS_PER_SEC)<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cerr<<endl; }
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << "\t"; err(++it, args...);
}
template<typename T1,typename T2>
ostream& operator <<(ostream& c,pair<T1,T2> &v){
	c<<"("<<v.fi<<","<<v.se<<")"; return c;
}
template <template <class...> class TT, class ...T>
ostream& operator<<(ostream& out,TT<T...>& c){
    out<<"{ ";
    forstl(x,c) out<<x<<" ";
    out<<"}"; return out;
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32; 
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM=1e5+5,MOD=1e9+7;
const ld EPS = 1e-9;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main(){
	fastio;

	int h,w,k; cin>>h>>w>>k;
	int col[h][w];

	forn(i,h){
		forn(j,w){
			char c; cin>>c;
			if(c == '#') col[i][j] = 0;
			if(c == '.') col[i][j] = 1;
		}
	}
	int ans = 0;
	// forn(i,h){
	// 	forn(j,w){
	// 		ans += (col[i][j] == 0);
	// 	}
	// }
	// cout<<ans<<ln;

	ans = 0;

	forn(x,1<<h){
		forn(y,1<<w){

			int c[h][w];
			forn(a,h){
				forn(b,w){
					c[a][b] = col[a][b];
				}
			}

			forn(i,h){
				forn(j,w){
					if((x&(1<<i))>0 || (y&(1<<j))>0){
						// cout<<x<<" "<<i<<" "<<(x&(1<<i))<<" "<<y<<" "<<j<<" "<<(y&(1<<j))<<" YES"<<endl;
						c[i][j] = 2;
					} 
				}
			}

			int ch = 0;
			forn(i,h){
				forn(j,w){
					if(c[i][j] == 0) ch++;
				}
			}
			// cout<<x<<" "<<(x&(1<<0))<<" "<<y<<" "<<ch<<ln;
			if(ch == k) ans++;
		}
	}

	cout<<ans<<ln;

	return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K,x,min;
  int i;
  cin >> N >> K;
  for(i=0;i<N;i++){
    cin >> x;
    if(abs(x) > abs(x-K)){
      min += abs(x-K)*2;
    }else{
      min += abs(x)*2;
    }
  }
  cout << min << endl;
}
  

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

modl = []

while n > 26:
    n, mod = divmod(n,26)
    if mod == 0:
        mod = 26
        n = n-1
    modl.append(mod)

modl.reverse()

print( chr(n+96),*[chr(i+96) for i in modl] ,sep="")

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

const int MAXV=(int) 2e5+2;
 
struct edge{
    int to;
};
 
vector <edge> G[MAXV];
int mark[MAXV];
bool visited[MAXV]={};

int search(int start, int count){
    queue <int> que;
    visited[start]=true;
    que.push(start);
    mark[start]=count;
    while(!que.empty()){
        count++;
        int v;
        v=que.front();
        que.pop();
        for(auto x: G[v]){
            if(visited[x.to]) continue;
            visited[x.to]=true;
            mark[x.to]=v;
            que.push(x.to);
        }
    }
    return 0;
}

int main(){
    int N,M;
    cin >> N >> M;
 
    for(int i=0; i<=N; i++){
        mark[i]=-1;
    }
 
    for(int i=0; i<M; i++){
        int a,b;
        cin >> a >> b;
        edge e = { b };
        G[a].push_back(e);
        e = { a };
        G[b].push_back(e);
    }

    int count=0;
    int start=1;

    search(start,count);

    cout << "Yes" << endl;
    for(int i=2; i<=N; i++){
        cout << mark[i] << endl;
    }

    return 0;
}

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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

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

    // 入力
    int n, m, c;
    cin >> n >> m >> c;
    int a[n][m], b[m];
    rep(i, m) { cin >> b[i]; }
    rep(i, n) {
        rep(j, m) { cin >> a[i][j]; }
    }

    // 処理
    int cnt = 0;
    int sum = 0;
    rep(i, n) {
        rep(j, m) { sum += a[i][j] * b[j]; }
        sum += c;
        if (sum > 0) {
            cnt++;
        }
        sum = 0;
    }

    // 出力
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
var GET = (function () {function f(s) {return new g(s);}function g(s) {this._s = s.trim().split("\n");}g.prototype.getValue = function (n) {return this._s[n];};g.prototype.getArray = function (n) {return this.stoa(this._s[n]);};g.prototype.slice = function (s, limit) {return this._s.slice(s, +limit + s || undefined).map(v => this.stox(v));};g.prototype.sliceArray = function (s, limit) {return this._s.slice(s, +limit + s || undefined).map(v => this.stoa(v));};g.prototype.stoa = function (s) {return s.split(" ").map(v => this.stox(v));};g.prototype.stox = function (v) {var i = +v;return (i === i) ? i : v;};return f;})();
var o = GET(require("fs").readFileSync("/dev/stdin", "utf8"));

console.log(main());
function main(){
    var l1 = o.getArray(0);
    var A = l1[0];
    var B = l1[1];

    var x, y;
    if (A >= B) {
        x = A;
        y = B;
    } else {
        x = B;
        y = A;
    }

    var num = gcd(x, y);
    var result = factorize(num);
    return result.length + 1;
}

function factorize(num) {
    var result = [];
    for(var i=2; i*i<=num; i++) {
        if (num%i) continue;
        var exponents = 0;
        while(num%i === 0) {
            num = num / i;
            exponents++;
        }
        result.push({base: i, exponents: exponents});
    }

    if (num !== 1) result.push({base: i, exponents: 0});

    return result;
}

function gcd(x, y) {
    if (y === 0) return x;
    return gcd(y, x%y);
}

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

using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
// end of Template

str s;
int main(){

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>s;
    int f = 0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='1')f++;
    }
    cout<<f<<newl;

}


Measured memory_bytes: 256
H,W,K=map(int,input().split())
S=[input() for _ in range(H)]

ans=0
for h in range(2**H): 
    for w in range(2**W):
        cnt=0
        for i in range(H):
            for j in range(W):
                if (h>>i&1): continue
                if (w>>j&1): continue
                if S[i][j]=="#": cnt+=1
        if cnt==K:ans+=1
print(ans)

Measured memory_bytes: 8996
#include<bits/stdc++.h>
using namespace std;
#define int long long
 
signed main(){
	string str;
	cin >> str;
	
	int a = 1e9;
	int z = -1;
	for(int i = 0; i < str.length(); i++){
		if(str[i] == 'A') a = min(a, i);
		else if(str[i] == 'Z') z = max(z, i);
	}
	
	cout << z - a + 1<< endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <algorithm>

template <typename Tp>
inline void read(Tp &x) {
    x = 0;
    bool f = true; char ch = getchar();
    for ( ; ch < '0' || ch > '9'; ch = getchar()) f ^= ch == '-';
    for ( ; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + (ch ^ 48);
    x = f ? x : -x;
}

const int N = 2e3 + 7, M = 4e6 + 7, P = 1e9 + 7;

int Dp[N][N], Fac[M], iFac[M];

inline int Power(int a, int x) {
    int res = 1;
    while (x) {
        if (x & 1) res = 1LL * res * a % P;
        a = 1LL * a * a % P;
        x >>= 1;
    }
    return res;
}

inline int Inv(int x) {
    return Power(x, P - 2);
}

inline int C(int n, int m) {
    if (m > n || m < 0) return 0;
    return 1LL * Fac[n] * iFac[n - m] % P * iFac[m] % P;
}

int main() {
    Fac[0] = 1;
    for (int i = 1; i < M; ++i) Fac[i] = 1LL * Fac[i - 1] * i % P;
    iFac[M - 1] = Inv(Fac[M - 1]);
    for (int i = M - 2; i >= 0; --i) iFac[i] = 1LL * iFac[i + 1] * (i + 1) % P;
    int n, k;
    read(n), read(k);
    if (k == 1) return printf("1\n"), 0;
    for (int i = 0; i <= n; ++i) Dp[i][0] = 1;
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= i; ++j) Dp[i][j] = (Dp[i - 1][j] + 1LL * Dp[i][j - 1] * (n - j + 1) % P * C(n * k - i - (j - 1) * (k - 1) - 1, k - 2) % P) % P;
    printf("%d\n", Dp[n][n]);
    return 0;
}

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

using namespace std;

int main ()
{
	int n, cek = 0;
	cin >> n;
	for (int i=1; i<10; i++){
		int a = n;
		if (n % i == 0){
			a /= i;
			if (a < 10){
				cek = 1;
				break;
			}
		}
	}
	if (cek == 1){
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;

struct UnionFind{
  vector<int> data;

  UnionFind(int N){
    data.assign(N,-1);
  }

 bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }
};

UnionFind uf(200000);


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n,m;
  cin>>n>>m;
  int ans=1;
 
  rep(i,m){
    int a,b;
    
    cin>>a>>b;
    a--;
    b--;
    uf.unite(a,b);
    ans=max(ans,uf.size(a));
  }
  cout<<ans<<endl;
    


  return 0;
}


Measured memory_bytes: 4624
N = int(input())
A = list(map(int, input().split()))

num_of_minus = sum([a < 0 for a in A])
abs_A = [abs(a) for a in A]
ans = sum(abs_A)

if num_of_minus % 2 == 0:
    print(ans)
else:
    print(ans - 2 * min(abs_A))

Measured memory_bytes: 14208
#include <bits/stdc++.h> 
using namespace std; 
#define int long long
void dfs(vector<int> graph[], int v, int vis[], vector<int> &comp)
{
    vis[v] = 1;
    comp.push_back(v);
    for(auto j : graph[v])
        if(!vis[j])
            dfs(graph, j, vis, comp);
}
signed main() {
    int n, m;
    cin >> n >> m;
    vector<int> graph[n+1];
    map<pair<int, int>, int> mp;
    int i;
    for(i=1;i<=m;i++)
    {
        int x, y;
        cin >> x >> y;
        if(mp.find({x, y}) == mp.end())
            graph[x].push_back(y), graph[y].push_back(x),mp[{x, y}]++, mp[{y, x}]++;
    }
    int vis[n+1] = {0};
    int maxa = 0;
    for(i=1;i<=n;i++)
        if(!vis[i])
        {
            vector<int> comp;
            dfs(graph, i, vis, comp);
            maxa = max(maxa, (int)comp.size());
        }
    cout << maxa;
}

Measured memory_bytes: 54880
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
const int maxn=1e6+5;
bool vis[maxn],b[maxn],c[maxn];
int n;
int a[maxn],mem[maxn];
inline void add(int x){
	if (vis[x]) return;
	for (int i=x;i<=1e6;i+=x){
		vis[i]=1;
	}
}
int main(){
	int cnt=0;
	cin>>n;
	for (int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		mem[a[i]]++;
	}
	sort(a+1,a+n+1);
	for (int i=1;i<=n;i++){
		if (vis[a[i]]==0&&mem[a[i]]==1) cnt++;
		add(a[i]);
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 9324
#include<iostream>

using namespace std;
int main(void){

	int L,M,N,wa=0,mo=-1;
	while(1){
		wa=0,mo=-1;
		cin>>L;
		if(L==0) break;
		for(int i=1;i<=12;i++){
			cin>>M>>N;
			wa+=M-N;
			if(wa>=L&&mo==-1) mo=i;
		}
		if(mo!=-1) cout<<mo<<endl;
		else cout<<"NA"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
using System;


class Program
{
    static void Main()
    {
        string[] str = Console.ReadLine().Split(' ');
        int a = int.Parse(str[0]);
        int b = int.Parse(str[1]);
        int c = int.Parse(str[2]);

        int[] num = { a, b, c };

        if (a > b)
        {
            num[0] = b;
            num[1] = a;
        }

        if (num[1] > c)
        {
            num[2] = num[1];
            num[1] = c;         
        }

        if (num[0] > num[1])
        {
            int x = num[0];
            num[0] = num[1];
            num[1] = x;
         
            
           
        }


        Console.WriteLine("{0} {1} {2}", num[0], num[1], num[2]);
    }
}

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

int main()
{	
	int n,d,sum,a;
	cin>>n>>d>>sum;
	for(int i=0;i<n;i++)
	{
		cin>>a;
		sum+=(d-1)/a+1;
	}
	cout<<sum<<endl;
	return 0;	
}


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

int main(){
  
  int N; cin >> N;
  vector<int> H(N);
  
  for(int i = 0; i < N; i++){
    cin >> H[i];
  }
  
  int cnt = 1;
  bool judge = true;
  
  for(int i = 1; i < N; i++){
   for(int j = i-1 ; j >= 0; j--){
     if(H[i] >= H[j]){
     }
     else if(H[i] < H[j]){
       judge = false;
       break;
     }
   }
   if(judge){
       cnt++;
   }
   judge = true;
  }
  
  cout << cnt << endl;
    
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int i, N, count = 0;
	long long D, x, y;
	scanf("%d %lld", &N, &D);
	for (i = 1; i <= N; i++) {
		scanf("%lld %lld", &x, &y);
		if (x * x + y * y <= D * D) count++;
	}
	printf("%d\n", count);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 1704
_ = int(input())
x = list(map(int,input().split()))
def p(m):
  l = [] 
  for i in x:
    s = (i-m)**2
    if s < 0:
      l.append(-s)
    else:
      l.append(s)
  return(sum(l))
a = [p(i) for i in range(100)]
print(min(a))

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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int min_total = 100000;
    if(min_total >= a + b) min_total = a + b;
    if(min_total >= b + c) min_total = b + c;
    if(min_total >= c + a) min_total = c + a;
    cout << min_total << endl;
    return 0;
}

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

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

    System.out.println(sb.reverse());
  }
}

Measured memory_bytes: 23868
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vt = vector<T>;
template<class T> using vvt = vector<vt<T>>;
template<class T> using ttt = tuple<T,T>;
using tii = tuple<int,int>;
using tiii = tuple<int,int,int>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
const ll DIV =1e9+7;
//const double PI = M_PI;
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
#define chmax(a,b) a=max(a,b)

/*Coding Space*/
int main(){
  int n,k;  cin >> n >> k;
  vi table(n); rep(i,n) cin >> table[i];
  
  int ans = 0;
  rep(i,n) if(table[i] < k) ans++;
  cout << n - ans << endl;
}


Measured memory_bytes: 640
using System.Linq;
using System;
using System.IO;
using System.Collections.Generic;

class Program
{
  static void Main(string[] args) =>
    new Program().solve();

  private void solve()
  {
    var seq = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    var a = seq[0];
    var b = seq[1];
    var c = seq[2];

    var ans = b / a >= c ? c : b / a;
    Console.WriteLine(ans);
  }
}

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

int main() {
  ll A;
  string B;
  cin >> A >> B;

  int pos = B.find_first_of('.');
  string s = B.substr(0, pos) + B.substr(pos + 1);
  ll ans = (A * stoll(s)) / 100;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3648
a=[0,0,0]
a[0],a[1],a[2]=map(int,input().split())
a=sorted(a)
sa1=a[2]-a[0]
sa2=a[2]-a[1]
if (a[0]%2==a[1]%2==a[2]%2):
  print(sa1//2 + sa2//2)
else:
  if (sa1%2==0 and sa2%2==1):
    print((sa1//2)+1 + (sa2+1)//2)
  elif (sa1%2==1 and sa2%2==0):
    print(((sa1+1)//2)+(sa2//2)+1)
  else:
    print((sa2-sa1)//2+sa1)

Measured memory_bytes: 3064
//
// Created by kuroneko on 2019-07-27.
//

#include <iostream>

using namespace std;
typedef long long ll;

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



Measured memory_bytes: 888
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const int D = 1000;
const double pi = acos(-1.0);

int main(void){
    int n;
    cin >> n;
    VD x(n), y(n);
    REP(i,n) cin >> x[i] >> y[i];

    function<double (double, double)> calc = [&](double cx, double cy){
        double r = 0.0;
        REP(i,n){
            double d = sqrt((x[i] - cx) * (x[i] - cx) + (y[i] - cy) * (y[i] - cy));
            chmax(r, d);
        }
        return r;
    };

    VD dx(D), dy(D);
    REP(i,D){
        double theta = 2 * pi * i / D;
        dx[i] = cos(theta);
        dy[i] = sin(theta);
    }

    double cx = 0.0, cy = 0.0;
    double d = 100;
    REP(i,100){
        bool found = true;
        while (found) {
            found = false;
            REP(k,D){
                double px = cx + dx[k] * d, py = cy + dy[k] * d;
                if (calc(px, py) < calc(cx, cy)){
                    cx = px;
                    cy = py;
                    found = true;
                    break;
                }
            }
        }
        d *= 0.5;
    }

    double ans = calc(cx, cy);
    printf("%.15f\n", ans);

    return 0;
}


Measured memory_bytes: 4120
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M, L; cin >> N >> M;
  for(int i = 0;i < M;i++){
  cin >> L;
  N = N - L;
  }
  if(N < 0) cout << -1 << endl;
  else cout << N << endl;
}

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

int main() {
  std::string S;
  size_t K;
  std::cin >> S >> K;

  for (size_t i = 0; i < K; ++i)
    if (S[i] != '1')
      return (std::cout << S[i] << std::endl), 0;

  std::cout << '1' << std::endl;
}

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

int main() {
  int n;
  cin >> n;
  ll ans = 0;
  vector<int> L(n);
  rep(i, n) cin >> L[i];
  sort(L.begin(), L.end());
  for (int i = 0; i < n; i++){
    for (int j = i + 1; j < n; j++){
      int left = j;
      int right = n;
      while(right - left > 1){
        int mid = (left + right) / 2;
        if(L[mid] < L[i] + L[j]){
          left = mid;
        }else {
          right = mid;
        }
      }
      ans += left - j;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

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

	int n, m, p;

	while(cin >> n >> m >> p && (n || m || p)){
		int sum = 0;
		int maisu = 0;
		int winner = -1;
		for (int i = 0;i < n;i++) {
			cin >> maisu;
			sum += maisu;
			if (i + 1 == m)winner = maisu;
		}

		if (winner!= 0) {
			cout << (sum*(100 - p)) / winner << endl;
		}
		else {
			cout << 0 << endl;
		}
		winner = -1;
		maisu = 0;
		sum = 0;


	} 

	return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(x) cerr << #x << ": " << x << '\n';
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, cnt = 0;
  cin >> n;
  vector<int> vec(n);
  for (int i = 0; i < n; ++i) {
    cin >> vec[i];
  }
  int tmp, sum;
  sort(vec.begin(), vec.end());
  
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      sum = vec[i] + vec[j];
      for (int k = n - 1; j < k; --k) {
        if (vec[k] < sum) {
          cnt += k - j;
          break;
        }
      }
    }
  }
  
  cout << cnt << '\n';
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		//input
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		for(int i=0;i<n;i++){
			System.out.println(sc.nextLine().replaceAll("Hoshino","Hoshina"));
		}
	}
}

Measured memory_bytes: 15424
import java.util.Scanner;

public class Main
{

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

		String b = sc.next();

		String ans = "";
		switch (b) {
		case "A":
			ans = "T";
			break;
		case "T":
			ans = "A";
			break;
		case "C":
			ans = "G";
			break;
		case "G":
			ans = "C";
			break;
		}

		System.out.println(ans);
		sc.close();
	}
}

Measured memory_bytes: 19924
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cctype>
#include <stack>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#define mst(a,b) memset(a,b,sizeof(a))

using namespace std;
typedef long long ll;
typedef pair<int,int> p;
const double PI=acos(-1.0);
const int inf=0x3f3f3f3f;
const double EE=exp(1.0);
const double eps=1e-9;
const ll mod=1000000007;
const int M=1e6;
/*
958681902
13276260*/
char a[M];
ll cnt[M];
ll ans,now,nxt,c=0;

int main() {
	int n,i;
	cin>>n;
	cin>>a>>a;
	for(i=0;i<n;i++) {
		if(a[i]!=a[i+1])
			cnt[c++]=1;
		else
			cnt[c++]=2,
			i++;
	}
	ans=cnt[0]*3;
	for(i=1;i<c;i++) {
		now=cnt[i-1];
		nxt=cnt[i];
		if(now==1){
			ans*=2;
			ans%=mod;
		}else{
			if(nxt==2)
				ans*=3;
			ans%=mod;
		}
	}
	printf("%lld\n",ans);
}


Measured memory_bytes: 2304
#import 
#=input()
s=int(input())
#=map(int,input().split())
#=list(map(int,input().split()))
#=[list(map(int,input().split())) for _ in range()]
mod = 10 ** 9 + 7

def f(a,b,c):
    re = 1
    q = max(b, c)
    for i in range(q+1, a+1):
        re *= i
    w = min(b, c)
    for i in range(1, w+1):
        re //= i
    return re % mod

ans = 0
fin = s // 3
for n in range(1, fin + 1):
    ans = ((ans + f(s - 2*n - 1, s - 3*n, n-1)) % mod)
print(ans)

Measured memory_bytes: 9200
#include<iostream>
#include<vector>
#include<set>
#include<string>
typedef long long int lli;
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    vector<string> v;
    vector<string> v1;
    
    string s1;
    string s2;
    
    cin >> s1;
    cin>>s2;
    v.push_back(s2);
    reverse(s1.begin(), s1.end());
    v1.push_back(s1);
   // cout<<s1<<"\n";
   if(v==v1){
        cout<<"YES"<<"\n";
    }else{
        cout<<"NO"<<"\n";
    }
    return 0;
}

//100 >1000
//10000 > 1000000

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

using namespace std;

#define ll long long
#define ull unsigned long long
#define PI acos(-1.0)
#define eps 1e-12
#define fi first
#define se second
#define MEM(a,b) memset((a),(b),sizeof(a))
#define mod(x) ((x)%MOD)
#define pii pair<int,int>
#define wz cout<<"-----"<<endl;
const int INF_INT = 2147483647;
const ll INF_LL = 9223372036854775807LL;
const ull INF_ULL = 18446744073709551615Ull;
const ll P = 92540646808111039LL;

const ll maxn = 1e5 + 10, MOD = 1e9 + 7;
const int Move[4][2] = {-1,0,1,0,0,1,0,-1};
const int Move_[8][2] = {-1,-1,-1,0,-1,1,0,-1,0,1,1,-1,1,0,1,1};

inline int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}


void init() {

}

vector<ll> v;

ll a[maxn],b[maxn],c[maxn];

int main(){
//    freopen("C:\\Users\\Administrator\\Desktop\\in.txt","r",stdin);
//    freopen("C:\\Users\\Administrator\\Desktop\\out.txt","w",stdout);
//    ios_base::sync_with_stdio(0);
    init();
    int n; cin >>n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    ll flg = 0;
    ll fu = 0;
    int res = 0;
    for (int i = 0; i < n; i++) {
        cin >> b[i];
        c[i] = a[i] - b[i];
        flg += c[i];
        if (c[i] < 0) fu += c[i], res++;
    }
    if (flg < 0) {
        puts("-1"); return 0;
    }
    sort(c, c + n);
    for (int i = n - 1; i >= 0; i--) {
        if (fu >= 0) break;
        res++;
        fu += c[i];
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main() 
{
    int n,i;
    cin>>n;
    int arr[n];
    for(i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    int a,x,b=0,y;
    for(i=n-2;i>=0;i--)
    {
        if(i==n-2){a=abs(arr[n-2]-arr[n-1]);}
        else
        {
            
            x=abs(arr[i]-arr[i+1])+a;
            y=abs(arr[i]-arr[i+2])+b;
            b=a;
            if(x>y){a=y;}
            else{a=x;}
        }

    }
    cout<<a;
}

Measured memory_bytes: 640
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int answer = 0;
        int ans = 0;
        String lung = sc.next();
        String[] test = lung.split("");

        for(int i=0; i<num; i++){
            if(test[i].equals("I")){
                ans++;
            }else if(test[i].equals("D")){
                ans--;
            }
            if(answer < ans)
                answer = ans;
        }
        System.out.println(answer);
    }
}

Measured memory_bytes: 23764
#include <iostream>

using namespace std;

int main(){

	double ary[41];
	double n;
	int n1 = 0,n2 = 0,n3 = 0,n4 = 0,n5 = 0,n6 = 0;

	cin >> n;

	for(int i = 0; i < n; i ++){
		cin >> ary[i];

		if(ary[i] < 165){
			n1++;
		}else if(ary[i] >= 165 && ary[i] < 170){
			n2++;
		}else if(ary[i] >= 170 && ary[i] < 175){
			n3++;
		}else if(ary[i] >= 175 && ary[i] < 180){
			n4++;
		}else if(ary[i] >= 180 && ary[i] < 185){
			n5++;
		}else if(ary[i] >= 185){
			n6++;
		}
	}

	cout << "1:";
	for(int i = 1; i <= n1; i++){
		cout << "*" ;
	}
	cout << endl;

	cout << "2:";
	for(int i = 1; i <= n2; i++){
		cout << "*";
	}
	cout << endl;

	cout << "3:";
	for(int i = 1; i <= n3; i++){
		cout << "*";
	}
	cout << endl;

	cout << "4:";
	for(int i = 1; i <= n4; i++){
		cout << "*";
	}
	cout << endl;

	cout << "5:";
	for(int i = 1; i <= n5; i++){
		cout <<"*";
	}
	cout << endl;

	cout << "6:";
	for(int i = 1; i <= n6; i++){
		cout << "*";
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 1220
//g++ -std=c++14 test.cpp -o test.out
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (LL)(1e18)+1;
const int INF_INT = 2147483647-1e6;
const LL mod = 1000000007ll;
 
LL N,A,B;
 
LL ans = 0;
 
void solve(){
	if(A==0){
		ans = 0;
		return;
	}
	if(B==0){
		ans = N;
		return;
	}
	LL chunk = A+B;
	LL remain = N%chunk;
	LL quo = (N-remain)/chunk;
	if(remain==0){
		ans = A*quo;
		return;
	}else{
		if(remain>A){
			ans = A*quo + A;
		}else{
			ans = A*quo + remain;
		}
	}
}
 
int main(){
	cin >> N >> A >> B;
 
	solve();
 
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long A,B,H,M,N,W;
  cin >> N >> M;
  
  cout << (N*(N-1)/2) + (M*(M-1)/2) << endl;
  //vector<long long> vec(N);
  //for (i=0;i<N;i++) {
   //cin >> vec.at(i);
  //}  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+100;
typedef long long ll;
ll a[maxn];
int main()
{
	std::ios::sync_with_stdio(false);
	int n;
	cin>>n;
	ll ans=0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		ans^=a[i];
	}
	if(ans==0)cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const double PI=3.1415926535;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a,b;
    ll ans;
    cin>>a>>b;
    if(a<6)
    {
        ans=0;
    }
    else if(a<=12&&a>=6)
    {
        ans=b/2;
    }
    else
        ans=b;
    cout<<ans<<'\n';













}



Measured memory_bytes: 256
/*input
apple
apple
*/

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

int main() {
    string s, t;
    cin >> s >> t;
    int n = s.size();
    int ans = 0;
    rep(i, n) {
        if (s[i] != t[i]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3888
#include<iostream>
#define N 32768
long a[N],b[N],c[N],n,k,i=N;int main(){for(std::cin>>n>>k;--i;a[i]=i<n?i:n)b[i]=n/i;while(--k){for(;++i<N;)c[i]=c[i-1]+b[i];for(*a=c[n/--i];--i;a[i]=c[i])*a=b[i]=(*a+a[i]*(n/i-n/(i+1)))%0x3B9ACA07;}std::cout<<*a;}

Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <iterator>
#include <sstream>
#include <vector>

using namespace std;

int main(int argc, char const *argv[]) {
  int N;
  cin >> N;
  vector<int> h(N);
  for (size_t i = 0; i < N; i++) {
    cin >> h[i];
  }

  int result = 0;
  int max = 0;
  for (size_t i = 0; i < N; i++) {
    if (h[i] >= max) {
      result++;
      max = h[i];
    }
  }
  cout << result << endl;
}

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

#define vec     vector<int>
#define vecll   vector<ll>
#define vec2    vector<vector<int>>
#define vec2ll  vector<vector<ll>>
#define vpair   vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>
#define vecst   vector<string>
#define vecb    vector<bool>

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define mpair(v1, v2)    make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << var << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << var;
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt((ok ? "Yes" : "No"));}
//----------------------------------------------------------------

int main(void) {
  double a;//, b, c;
  cin >> a;// >> b >> c;

  prtd(5, a*2*M_PI);
}


Measured memory_bytes: 3784
#include <bits/stdc++.h>
using namespace std;
int main() {
int N; 
cin >> N; 
int A[100010] = {}; 
for(int i = 1; i <= N; i++){
int j; 
cin >> j; 
if(i == j){
A[i] = A[i-1] + 1; 
}
}
int ans = 0; 
for(int i = 1; i <= N; i++){
if(A[i+1] == 0){
ans += (A[i]+1)/2; 
}
}
cout << ans << endl; 
}

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

    const int MOD = 1000000007;
    const double PI = acos(-1); 

    //long long
    using ll = long long;

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

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

    //最大公約数（ll）
    ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x;}

    //素因数分解
    vector<pair<ll, int>>factorize(ll n){
      vector<pair<ll, int>> res;
      for(ll i = 2; i * i <= n; ++i){
        if(n % i) continue;
        res.emplace_back(i, 0);
        while(n % i == 0){
          n /= i;
          res.back().second++;
        }
      }
    if(n != 1) res.emplace_back(n, 1);
    return res;
    }



  // // 二分探索(最小値を出す問題は疑う)
  // bool C(ll x){
  //     ll res = 0;
  //     for(int i = 0; i < N; ++i){
  // 		res += max(0ll, A[i]-x/F[i]);
  //     }
  //     return res <= K;
  // }

  //   ll binary_search(ll ok, ll ng){
  //     while(abs(ok - ng) > 1){
  //       ll mid = (ok + ng) / 2;
  //       if(C(mid)) ok = mid;
  //       else ng = mid;
  //     }
  //     return ok;
  //   }


  int main(){
 int one = 0, seven = 0, nine = 0, four = 0;
 
    REP(i, 4){
      int x;
      cin >> x;
      if(x == 1) one++;
      if(x == 7) seven++;
      if(x == 9) nine++;
      if(x == 4) four++;
    }
  
  if(one == 1 && seven == 1 && nine == 1 && four == 1) YES;
  else NO;

  }

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main() {
    long long int a,b,n;
    cin >>a >>b >>n;
    if(b <= n) {
        cout << floor(a*(b-1)/b) -(a*floor((b-1)/b)) << endl;
        return 0;
    } else {
        cout << floor(a*n/b) -(a*floor(n/b)) << endl;
        return 0;
    }
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int N, M;
    cin >> N >> M;
    int l, r;
    vector<int> gate(N+2);
    for (int i = 0; i < M; i++) {
        cin >> l >> r;
        gate[l]++;
        gate[r+1]--;
    }
    for (int i = 0; i < N + 1; i++) { gate[i+1] += gate[i]; }
    int ans = 0;
    for (int g : gate) {if (g == M) ans++;}
    cout << ans << '\n';
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define N 200005
int a[N],b[N];
using namespace std;
int main(){
    int c,d,e,f;
    cin>>e>>f;
    for(int i=0;i<f;i++){
        cin>>c>>d;
        if(c==1) a[d]=1;
        if(d==e) b[c]=1;
    }
    for(int j=1;j<e;j++){
        if(a[j]==1&&b[j]==1){
            cout<<"POSSIBLE"<<endl;
            return 0;
        }   
    }
    cout<<"IMPOSSIBLE"<<endl;
    return 0;
}

Measured memory_bytes: 1792
fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(' ').map { it.toInt() }
    val nums = LongArray(k)
    for (i in 1..n) nums[i % k]++
    var ans = 0L
    for (a in 0 until k) {
        val b = (k - a) % k
        val c = (k - a) % k
        if ((b + c) % k != 0) continue
        ans += nums[a] * nums[b] * nums[c]
    }
    println(ans)
}


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

int main() {
  int N, l, r, sum=0;
  cin >> N;
  
  for(int i=0;i<N;i++){
    cin >> l >> r ;
    sum += r - l + 1;
  }
  
  cout << sum << endl;
  
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    char num[1024];
    int sum;
    int i;
    while(1){
        sum=0;
        i=0;
        scanf("%s",num);
        if(num[0]=='0')
            break;
        while(num[i]!='\0'){
            sum+=num[i]-'0';
            i++;
        }
        printf("%d\n",sum);
    }
    return 0;
}

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

int main(){
	int math[101][101]={0};
	int r,c,sum;
	cin>>r>>c;
	for(int i=0;i<r;i++){
		sum=0;
		for(int j=0;j<c;j++){
			cin>>math[i][j];
			sum+=math[i][j];
		}
		math[i][c]=sum;
	}
	for(int j=0;j<c+1;j++){
		sum=0;
		for(int i=0;i<r;i++){
			sum+=math[i][j];
		}
		math[r][j]=sum;
	}
	for(int i=0;i<r+1;i++){
		for(int j=0;j<c;j++){
			cout<<math[i][j]<<" ";
		}
		cout<<math[i][c]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1204
#include<bits/stdc++.h>
using namespace std;
float odd(int n)
{
    int i,j=0;
    float p;
    for(i=n;i>0;i--)
    {
        if(i%2!=0)
        {
            j++;
        }
    }
    p=(float)j/n;

    return p;
}
int main()
{
    int x;
    float t;
    cin >> x;
    t=odd(x);
    cout<<setprecision(6);
    cout << t <<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int v = sc.nextInt();
		int b = sc.nextInt();
		int w = sc.nextInt();
		int t = sc.nextInt();
		if(v < w) {
			System.out.println("NO");
			return;
		}
		if(b < a) {
			if((a-t*v)-(b-w*t)<=0) {
				System.out.println("YES");
				return;
			}
			else {
				System.out.println("NO");
				return;
			}
		}
		if(b > a) {
			if((a+t*v)-(b+w*t)>=0) {
				System.out.println("YES");
				return;
			}
			else {
				System.out.println("NO");
				return;
			}
		}
	}
}

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

Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
template<typename T> auto compare = [](T x, T y) -> bool{return (x < y);};
const int MOD = 1000000007;

signed main(){
    int A, B, C, K;
    cin >> A >> B >> C >> K;
    ll ans = 0;
    if(K <= A){
        ans += K;
        PRINT(ans);
        return 0;
    }else{
        ans += A;
        K -= A;
    }
    if(K <= B){
        PRINT(ans);
        return 0;
    }else{
        K -= B;
    }
    PRINT(ans - K);
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int IMAX=((1<<30)-1)*2+1;
const double EPS=1e-10;
//int mod=1000000007


int main(){
	int n;
	int a,b,c;
	string s;
	bool f=false;
	while(cin>>n && n>0){
		vector<pair<pii,string> >v(n);
		rep(i,n){
			cin>>s>>a>>b>>c;
			v[i].fi.fi=a*3+c;
			v[i].fi.se=i*(-1);
			v[i].se=s;
		}
		sort(all(v));
		reverse(all(v));
		if(f)cout<<endl;
		f=true;
		rep(i,n){
			cout<<v[i].se<<","<<v[i].fi.fi<<endl;
		}
	}
}

Measured memory_bytes: 1220
using System;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int p = int.Parse(input[0]);
            int q = int.Parse(input[1]);
            int r = int.Parse(input[2]);
            int ans = p + q + r;
            if (p + q < ans)
                ans = p + q;
            if (p + r < ans)
                ans = p + r;
            if (r + q < ans)
                ans = r + q;
            Console.WriteLine(ans);
        }
    }
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 40;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  ll a;
  string b;
  cin >> a >> b;
  ll bb = (b[0] - '0')*100 + (b[2]-'0')*10 + (b[3]-'0');
  ll ans = a*bb;
  ans /= 100;
  cout << ans << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln =  '\n';

const int mx=100010;
const ll mod=1e9+7;

vector<int> dp(mx,-1);
vector<int> a(110);
  int n,k;

int rec(int x){
  if(dp[x]!=-1) return dp[x];
  if(x<a[0]) return dp[x] = 0;
  int tmp = 0;
  rep(i,n){
    if(x-a[i]<0) continue;
    tmp |= !rec(x-a[i]);
  }
  return dp[x] = tmp;
}

int main(){
  cin >> n >> k;
  a.resize(n);
  rep(i,n){
    cin >> a[i];
  }
  sort(a.begin(),a.end());
  if(rec(k)){
    cout << "First" << endl;
  } else {
    cout << "Second" << endl;
  }
  return 0;
}

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

#define ll long long
#define int long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf (int)(1e18)
#define ps(x, y) fixed << setprecision(y) << x
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define all(p) p.begin(), p.end()
#define ub(a, b) upper_bound(all(a), b)
#define lb(a, b) lower_bound(all(a), b)
#define PI 3.14159265
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void run()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
void solution()
{
}
int32_t main()
{
    run();
    char a;
    cin >> a;
    if ((a - 'a') < 26 and (a - 'a' >= 0))
    {
        cout << 'a' << endl;
    }
    else
    {
        cout << 'A' << endl;
    }
    return 0;
}

Measured memory_bytes: 3608