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

const int ma = 1e3 + 33, maxn = 3, mod = 1e9 + 7;
bool grid[ma][ma];

ll pow(ll a, ll b){
    if(b == 0) return 1;
    if(b % 2 == 0) return (pow(a, b/2)*pow(a, b/2))%mod;
    return ((pow(a, b/2)*pow(a, b/2))%mod * a)%mod;
}


struct mat{
    ll t[maxn][maxn];

    mat(ll x = 0){
        for(int i=0; i<maxn; ++i){
            for(int j = 0; j<maxn; ++j){
                t[i][j] = i == j ? x : 0;
            }
        }
    }

    mat operator * (mat drugi){
        mat wyn(0);
        for(int i = 0; i < maxn; ++i){
            for(int j = 0; j < maxn; ++j){
                for(int k = 0; k < maxn; ++k){
                    wyn.t[i][j] += t[i][k] * drugi.t[k][j];
                    wyn.t[i][j] += mod;
                    wyn.t[i][j] %= mod;
                }
            }
        }
        return wyn;
    }
};


mat pot(mat a, ll n) {
    mat wyn(1);
    while(n) {
        if(n % 2 == 1)
            wyn = wyn * a;
        a = a * a;
        n /= 2;
    }
    return wyn;
}


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n, m, k;
    cin >> n >> m >> k;

    string s;
    ll cells = 0;
    ll g = 0, b = 0;

    for(int i=1; i<=n; i++){
        cin >> s;
        grid[i][1] = (s[0] == '#');
        cells += (s[0] == '#');
        if(grid[i][1] && grid[i-1][1]){
            b++;
        }

        for(int j=1; j<m; j++){
            grid[i][j+1] = (s[j] == '#');
            cells += (s[j] == '#');
            if(grid[i][j+1] && grid[i][j]) g++;
            if(grid[i][j+1] && grid[i-1][j+1]) b++;
        }
    }

    ll dir = 0, ver = 0, hor = 0;

    for(int i=1; i<=n; i++){
        if(grid[1][i] && grid[n][i]){
            hor++;
        }
        if(grid[i][1] && grid[i][m]){
            ver++;
        }
    }

    if(ver > 0 && hor > 0){
        cout << 1;
        return 0;
    }
    if(ver == 0 && hor == 0){
        cout << pow(cells, k-1);
        return 0;
    }

    dir = hor + ver;

    mat a;
    a.t[0][0] = cells;
    a.t[0][1] = -(hor > 0)*b -(ver>0)*g;
    a.t[1][1] = dir;

    a = pot(a, k-1);
    ll wyn = a.t[0][0] + a.t[0][1];

    wyn += mod;
    wyn %= mod;
    cout << wyn;

}


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

int main() {
    int n; cin >> n;
    vector<tuple<string,int,int>> a;
    for(int i = 0; i < n; i++){
        string s;
        int p;
        cin >> s >> p;
        p = -p;
        a.push_back(tie(s,p,i));
    }
    sort(a.begin(), a.end());
    for(int i = 0; i < n; i++){
        cout << get<2>(a[i]) + 1 << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<queue>
#include<complex>
typedef long long ll;

using namespace std;
#define N 100010
ll n;
ll a[N],b[N],l[N],r[N];
ll sp,tp;
priority_queue<ll> S,s;
priority_queue<ll,vector<ll>,greater<ll> >T,t;
ll Sf(){
  return S.top()+sp;
}
ll Tf(){
  return T.top()+tp;
}
void Sp(ll x){
  S.push(x-sp);
}
void Tp(ll x){
  T.push(x-tp);
}
void Outs(){
  s=S,t=T;
  cout<<"s=";
  while(s.size()>1){
    cout<<s.top()+sp<<" ";
    s.pop();
  }cout<<endl;
  cout<<"t=";
  while(t.size()>1){
    cout<<t.top()+tp<<" ";
    t.pop();
  }cout<<endl;
  cout<<"----------"<<endl;
}
int main(){
    cin>>n;
    if(n>N)return 0;
    for(int i=0;i<n;i++)cin>>l[i]>>r[i];
    for(int i=1;i<n;i++){
      a[i]=l[i]-r[i-1];
      b[i]=r[i]-l[i-1];
      //cout<<i<<":"<<a[i]<<" "<<b[i]<<endl;
    }
    ll ans=0; sp=tp=0;
    Sp(0); Tp(0);
    Sp(-1e17); Tp(1e17);
    for(int i=1;i<n;i++){
      sp-=b[i],tp-=a[i];
      //cout<<"$"<<endl;
      //Outs();
      ll s0=Sf();
      ll t0=Tf();
      if(s0<=0&&0<=t0){
	Sp(0); Tp(0);
      }
      if(0<s0){
	Sp(0); Sp(0);
	Tp(Sf());
	ans+=abs(Sf());
	S.pop();
      }
      if(t0<0){
	Tp(0); Tp(0);
	Sp(Tf());
	ans+=abs(Tf());
	T.pop();
      }
      //Outs();
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5228
from functools import reduce

S = input()

MOD = 10**9 + 7


class ModInt:
    def __init__(self, x):
        self.x = x % MOD

    def __str__(self):
        return str(self.x)

    __repr__ = __str__

    def __add__(self, other):
        return (
            ModInt(self.x + other.x) if isinstance(other, ModInt) else
            ModInt(self.x + other)
        )

    def __sub__(self, other):
        return (
            ModInt(self.x - other.x) if isinstance(other, ModInt) else
            ModInt(self.x - other)
        )

    def __mul__(self, other):
        return (
            ModInt(self.x * other.x) if isinstance(other, ModInt) else
            ModInt(self.x * other)
        )

    def __truediv__(self, other):
        return (
            ModInt(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(self.x * pow(other, MOD - 2, MOD))
        )

    def __pow__(self, other):
        return (
            ModInt(
                pow(self.x, other.x, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(pow(self.x, other, MOD))
        )

    def __radd__(self, other):
        return ModInt(other + self.x)

    def __rsub__(self, other):
        return ModInt(other - self.x)

    def __rmul__(self, other):
        return ModInt(other * self.x)

    def __rtruediv__(self, other):
        return ModInt(other * pow(self.x, MOD - 2, MOD))

    def __rpow__(self, other):
        return ModInt(pow(other, self.x, MOD))


# 動的計画法による。すなわち、
# i文字目までのA数, AB数, ABC数を求め、それらを用いて
# N文字目までのABC数を求める
_, _, _, ans = reduce(
    lambda acc, c: (
        (
            3 * acc[0] if c == '?' else
            acc[0]
        ),
        (
            acc[0] + acc[1] if c == 'A' else
            3 * acc[1] + acc[0] if c == '?' else
            acc[1]
        ),
        (
            acc[1] + acc[2] if c == 'B' else
            3 * acc[2] + acc[1] if c == '?' else
            acc[2]
        ),
        (
            acc[2] + acc[3] if c == 'C' else
            3 * acc[3] + acc[2] if c == '?' else
            acc[3]
        ),
    ),
    S,
    (ModInt(1), ModInt(0), ModInt(0), ModInt(0))
)

print(ans)


Measured memory_bytes: 3932
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <string>
#include <typeinfo>
#include <vector>
//#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;

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

int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  if(a<c&&c<b){
    cout << "Yes" << endl;
  }else if(b<c&&c<a){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"
#define debug(x) cout<<#x<<" = "<<x<<endl;

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

void solve()
{
	li x;

	cin>>x;

	li tp=x/200;

	li s=10-tp*2;

	cout<<tp+s;
}

int main()
{    
    

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li t=1;

    // cin>>t;

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

    return 0;
}

Measured memory_bytes: 3628
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

int main()
{
	string s;
	cin >> s;

	s[3] = '8';

	cout << s << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
static const int A = 100;

int main(){
  int M[A][A];
  int n, u, l, v;

  int i, j;
  scanf("%d", &n);

  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++)M[i][j] = 0;
  }

  for(i = 0; i < n; i++){
    scanf("%d%d",&u, &l);
    u--;
    for(j = 0; j < l; j++){
      scanf("%d",&v);
      v--;
      M[u][v] = 1;
    }
  }
  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      if(j)printf(" ");
      printf("%d",M[i][j]);
    }
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 2052
w, h, n = map(int, input().split())
x_pos = [0, w]
y_pos = [0, h]
for _ in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        x_pos[0] = max(x_pos[0], x)
    elif a == 2:
        x_pos[1] = min(x_pos[1], x)
    elif a == 3:
        y_pos[0] = max(y_pos[0], y)
    else:
        y_pos[1] = min(y_pos[1], y)
if x_pos[1] - x_pos[0] < 0 or y_pos[1] - y_pos[0] < 0:
    ans = 0
else:
    ans = (x_pos[1] - x_pos[0] ) * (y_pos[1] - y_pos[0])
print(ans)

Measured memory_bytes: 9192
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[3];
        int sum = 0;
        for (int i = 0; i < a.length; i++) {
            a[i] = sc.nextInt();
            sum += a[i];
        }
        if (sum >= 22) {
            System.out.println("bust");
        } else {
            System.out.println("win");
        }
        sc.close();
    }
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
 
using ll = int64_t;
constexpr ll mod = ll(1e9 + 7);
 
int main () {
  ios::sync_with_stdio(0); cin.tie(0);
 
  int TT = 1;
//  cin >> TT;
  while (TT--) {
    char c;
    cin >> c;
    if (isupper(c)) {
      cout << 'A' << endl;
    } else {
      cout << 'a' << endl;
    }
    
  }
}


Measured memory_bytes: 3592
unittest
{
	assert( [ "SENW" ].parse.expand.solve == "Yes" );
	assert( [ "NSNNSNSN" ].parse.expand.solve == "Yes" );
	assert( [ "NNEW" ].parse.expand.solve == "No" );
	assert( [ "W" ].parse.expand.solve == "No" );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto s = input.front.to!( dchar[] );
	return tuple( s );
}

auto solve( dchar[] s )
{
	auto ce = false;
	auto cw = false;
	auto cn = false;
	auto cs = false;
	foreach( u; s.sort().uniq )
	{
		final switch( u )
		{
			case 'E': ce = true; break;
			case 'W': cw = true; break;
			case 'N': cn = true; break;
			case 'S': cs = true; break;
		}
	}
	return ( ce == cw && cn == cs ) ? "Yes" : "No";
}


Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    A = list(map(int,input().split()))
    A.sort(reverse=True)
    ans = A[0]
    for i in range(2,N):
        ans += A[i//2]
    print(ans)


if __name__ == '__main__':
    main()


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

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  if(n % 2 != 0)
    n = (n / 2) + 1;
  else
    n = n / 2;
  cout << n << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<iomanip>

using namespace std; 

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


int main() {
    
  int r, D, ans = 0, a;
  int i;
  
  cin >> r >> D >> a;

  ans = r * a - D;
  cout << ans << endl;
  REP(i, 9){
  	ans = r * ans - D;
	cout << ans << endl;
  }
  return 0;
}

/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 256
import sys
readline = sys.stdin.buffer.readline
read = sys.stdin.buffer.read

import numpy as np


N, M, X = map(int, readline().split())
C = []
A = []
ans = []

for _ in range(N):
    I = list(map(int, readline().split()))
    c = I.pop(0)
    C.append(c)
    a = np.array(I)
    A.append(a)

for b in range(2**12):
    c = 0
    U = np.zeros((M,))
    for i in range(N):
        f = b >> i & 1
        if f:
            c += C[i]
            U = U + A[i]
    if np.all(U >= X):
        ans.append(c)

if ans:
    print(min(ans))
else:
    print(-1)

Measured memory_bytes: 27200
#include<iostream>
#include<string>
using namespace std;
int main(){
	int a,c,max;
	string b;
	c=0;
	max=0;
	cin>>a>>b;
	for(int i=0;i<a;i++){
		if(b[i]=='D'){
		c--;
		}
		if(b[i]=='I'){
		c++;
		}
		if(max<c){
		max=c;
		}
	}
		cout<<max<<endl;
}


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

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

    map<int, int> mp;

    for (size_t i = 1; i < 10; i++)
    {
      for (size_t j = 1; j < 10; j++)
      {
        mp[i*j]++;
      }
    }

    if (mp[n] > 0) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }   
    
}

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

const int maxn=1e5+7;
int n,k,a;
long long ans;
priority_queue<int,vector<int>,less<int> > q;

int main()
{
	scanf("%d %d",&n,&k);
	for(int i=1;i<=n;++i) {
		scanf("%d",&a);
		q.push(a);
	}
	while(k--) {
		a=q.top();q.pop();
		a/=2;q.push(a);
	}
	while(!q.empty()) {
		ans+=q.top();q.pop();
	}
	printf("%lld",ans);
}

Measured memory_bytes: 892
#include <iostream>
using namespace std;
int main(){
  int n,i,c,s;
  cin >> n;
  for(i=1;i<=n;i++){
    cout << "Case " << i << ':' << endl;
    cin >> s;
    c=10;
   while(c){
     s=s*s;
     s/=100;
     s%=10000;
     cout << s << endl;   
     c--;
   }
  }
  return 0;
}

Measured memory_bytes: 1156
import java.util.Scanner;
import java.util.Arrays;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count= 0;
        for(int i = 1;i <= a;i++){
            for(int j = 1;j <= 31;j++){
                if(i == a && j > b){
                    break;
                }
                if(i == j){
                    count++;
                }
            }
        }
        System.out.println(count);
    }
}


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

int main(){
   int N;
   cin >> N;
   map<string, int> blue;
   for (int i=0; i<N; i++){
      string key;
      cin >> key;
      blue[key]++;
   }
   int M;
   cin >> M;
   map<string, int> red;
   for (int i=0; i<M; i++){
      string key;
      cin >> key;
      red[key]++;
   }
   int max = 0;
   for (auto x : blue){
      string key = x.first;
      if (blue[key] - red[key] > max){
         max = blue[key] - red[key];
      }
   }
   cout << max << endl;
}



Measured memory_bytes: 256
from heapq import heappush, heappop
import queue
import re
import math
import functools

def s_raw():
    return input().rstrip("\r")

def int_raw():
    return int(input())


def ss_raw():
    return input().split()


def ints_raw():
    return list(map(int, ss_raw()))


INF = 1 << 29


def make1d_arr(n, val=INF):
    return [val for i in range(n)]


def make2d_arr(h, w, val=INF):
    return [[val for i in range(w)]for i in range(h)]


def gcd(a, b):
    if(b == 0):
        return a
    return gcd(b, a % b)


def BFord(n,es):
    v_cost = [INF]*n
    v_cost[0] = 0
    for v in range(n*2):
        for e in es:
            frm = e[0]
            to = e[1]
            if v_cost[to] > v_cost[frm]+e[2]:
                v_cost[to] = v_cost[frm]+e[2]
                if v >= n:
                    v_cost[to] = -INF
        if v == n-1:
            prev = v_cost[:]
    v_cost = [-INF if prev[idx]!=v_cost[idx] else v_cost[idx] for idx in range(n)]
    return v_cost
    
def ZAlgo(s):
    l = len(s)
    A = [0]*l
    i =1
    j =0
    A[0]=l
    while i<l:
        while i+j<l and s[j] == s[i+j]:
            j+=1
        if j==0:
            i+=1
            continue
        A[i]=j
        k=1
        while (i+k<l) and (k+A[k]<j):
            A[i+k] =A[k]
            k+=1
        i+=k
        j-=k
    return A


def main():
    n = int_raw()
    S = s_raw()
    ans = 0
    for s_idx in range(len(S)):
        A = ZAlgo(S[s_idx:])
        ans = max([min(idx,a) for idx,a in enumerate(A)]+[ans])
    return ans


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 57048
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF = 2e9
#define LINF = 1e18
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << = << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO")
#define Yes(n) cout << ((n) ? "Yes" : "No")

int main(){

    int m, f, r;

    while(1){
        cin >> m >> f >> r;
        if(m == -1 && f == -1 & r == -1)return 0;
        char rank = 'F';
        if(m != -1 && f != -1 && m+f >= 30){
            if(m+f < 50){
                if(r >= 50)rank = 'C';
                else rank = 'D';
            }else if(m+f < 65)rank = 'C';
            else if(m+f < 80)rank = 'B';
            else rank = 'A';
        }
        cout << rank << endl;
    }

}


Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define boost ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)

 ll gcd(ll a,ll b)
 {
    if(b == 0) return a;
    return gcd(b,a%b);
 }
 
 ll lcm(ll a,ll b)
 {
     ll g=gcd(a,b);
     return a/g*b;
 }
int main()
{
    boost;
    ll n,ans,x;
    cin>>n;
    ans=1LL;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        ans=lcm(ans,x);
    }
    cout<<ans<<endl; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
  int N;
  cin >> N;
  ll dp[110000][2][2][2];
  for(int i=0; i<110000; i++) for(int j=0; j<2; j++) for(int k=0; k<2; k++) for(int l=0; l<2; l++) dp[i][j][k][l] = 0;
  
  ll a[N+1];
  ll b[N+1];
  ll c[N+1];
  for(int i=0; i<N; i++){
    cin >> a[i+1] >> b[i+1] >> c[i+1];
  }
  dp[1][1][0][0] = a[1];
  dp[1][0][1][0] = b[1];    
  dp[1][0][0][1] = c[1];
  
  for(int i=1; i<N; i++){
    dp[i+1][1][0][0] = max(dp[i][0][1][0], dp[i][0][0][1]) + a[i+1];
    dp[i+1][0][1][0] = max(dp[i][1][0][0], dp[i][0][0][1]) + b[i+1];
    dp[i+1][0][0][1] = max(dp[i][1][0][0], dp[i][0][1][0]) + c[i+1];
  }
  
  ll ans = max(dp[N][1][0][0], dp[N][0][1][0]);
  ans = max(ans, dp[N][0][0][1]);
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 9472
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stdint.h>
int main(){
  int x,y;
  scanf("%d %d", &x, &y);
  if(x != 1 && y != 1)
	  printf("%lld", (uint64_t)((uint64_t)ceil(x/2.0) * (uint64_t)ceil(y/2.0) + (uint64_t)floor(x/2.0) * (uint64_t)floor(y/2.0)));
  else
	  puts("1");
}


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

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr 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;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    for (int bit=1; bit<1<<3; ++bit) {
        int tmp = s[0] - '0';
        rep(i, 3) {
            if (1<<i & bit) tmp += (s[i+1] - '0');
            else tmp -= (s[i+1] - '0');
        }
        if (tmp == 7) {
            rep(i, 3) {
                cout << s[i];
                if (1<<i & bit) cout << "+";
                else cout << "-";
            }
            cout << s[3] << "=7" << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <vector>
#include <iomanip>
#include <sstream>
#include <unordered_map>

using namespace std;
typedef long long ll;


ll ans, mx, mn, flag, sum=1, cnt;

ll idx=1;
int main(){
	ll n,x;
	cin>>n>>x;
	ll d[n+1];
	d[0]=0;
	ll l[n+1];
	l[0]=0;
	for(ll i=1; i<=n; i++){
		cin>>l[i];
	}
	for(ll i=1; i<=n+1; i++){
		d[i]=d[i-1]+l[i-1];
	}
	for(ll i=1; i<=n+1; i++){
		if(d[i]<=x) ans++;
	}
	cout<<ans<<endl;
}


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

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

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

void Main()
{
  int N; cin >> N;
  vector<ll> cnt(100000);
  ll amount = 0;
  rep(i,N) {
    ll a; cin >> a;
    amount += a;
    cnt[a-1]++;
  }
  int Q; cin >> Q;
  rep(i,Q) {
    ll b,c; cin >> b >> c;
    amount -= b*cnt[b-1];
    amount += c*(cnt[b-1]);
    cnt[c-1] += cnt[b-1];
    cnt[b-1] = 0;
    cout << amount << endl;
  }
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 3992
import java.util.*;
import java.text.*;
public class Main {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		double a = in.nextDouble();
		double b = in.nextDouble();
		int d = (int)a/(int)b;
		int r = (int)a%(int)b;
		double f = a/b;
		DecimalFormat fm = new DecimalFormat("#.######");
		System.out.println(d+" "+r+" "+fm.format(f));
	}
}

Measured memory_bytes: 12000
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;

int d[50][50];
int cnt[3][50];
int n,c;

int main()
{
	scanf("%d%d",&n,&c);
	for (int i=1;i<=c;i++)
		for (int j=1;j<=c;j++)
			scanf("%d",&d[i][j]);
			
	int x;
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++)
			scanf("%d",&x),cnt[(i+j)%3][x]++;	
			
	long long ans=0x3f3f3f3f; 
	for (int i=1;i<=c;i++)
		for (int j=1;j<=c;j++)	
				for (int k=1;k<=c;k++)
				{
					long long sum=0;
					if (i == k || j == k || i == j) continue;
					for (int x=1;x<=c;x++) sum+=d[x][i]*cnt[0][x];
					for (int x=1;x<=c;x++) sum+=d[x][j]*cnt[1][x];
					for (int x=1;x<=c;x++) sum+=d[x][k]*cnt[2][x];
					if (sum<ans) ans=sum;
				}		
	printf("%lld\n",ans);
	return 0;	
} 

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

using namespace std;

int main(void)
{
    long long sum = 0;
    int N;
    cin >> N;
    vector<int> d(N);
    for (int i = 0; i < N; i++) {
        cin >> d[i];
        if (i == 0)
            continue;
        for (int j = 0; j < i; j++) {
            sum += d[i] * d[j];
        }
    }
    cout << sum << endl;
}

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

#include <boost/rational.hpp>

#define REP(i, n) for (decltype(n) i = 0; i < (n); ++i)
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
using boost::rational;

const i64 MOD = 1000000007;

template <long long MOD>
struct mint {
  long long x;
  mint(long long 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 { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(long long 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 { return mint(*this) /= a; }
};
template <long long MOD>
istream& operator>>(istream& is, const mint<MOD>& a) {
  return is >> a.x;
}
template <long long MOD>
ostream& operator<<(ostream& os, const mint<MOD>& a) {
  return os << a.x;
}

int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  i64 N;
  cin >> N;
  i64 cnt_ab0 = 0, cnt_a0 = 0, cnt_b0 = 0;
  map<rational<i64>, i64> cnt_r;

  REP(i, N) {
    i64 a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      ++cnt_ab0;
    } else if (a == 0) {
      ++cnt_a0;
    } else if (b == 0) {
      ++cnt_b0;
    } else {
      rational<i64> r{a, b};
      ++cnt_r[move(r)];
    }
  }

  set<rational<i64>> rpairs;
  for (auto&& [r, val] : cnt_r) {
    if (r > 0) {
      rpairs.insert(r);
    } else {
      rpairs.insert(-1 / r);
    }
  }

  vector<i64> pow2(N + 1);
  pow2[0] = 1;
  REP(i, N) { pow2[i + 1] = (pow2[i] << 1) % MOD; }

  mint<MOD> ans{1};
  for (const auto& r1 : rpairs) {
    auto r2 = -1 / r1;
    ans *= pow2[cnt_r[r1]] + pow2[cnt_r[r2]] - 1;
  }
  ans *= pow2[cnt_a0] + pow2[cnt_b0] - 1;
  ans += cnt_ab0 - 1;
  cout << ans.x << endl;
}

Measured memory_bytes: 42092
#include <bits/stdc++.h>
#define rep(i, s, e) for(int i = s; i < e; i++)
#define rrep(i, s, e) for(int i = s; i > (s)-(e); i--)
#define pr(s) std::cout << s << std::endl
#define prb(s) std::cout << s
using namespace std;



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


  string s;
  cin >> s;

  replace(s.begin(), s.end(), ',', ' ');
  pr(s);


  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define SIZE 100005

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int main()
{
	ll K,A,B;
	scanf("%lld %lld %lld",&K,&A,&B);
	ll ret=1;
	if(A+2>=B)
	{
		ret+=K;
	}
	else
	{
		ll z=min(K,A-1);
		ret+=z;
		K-=z;
		ret+=(B-A)*(K/2);
		ret+=K%2;
	}
	printf("%lld\n",ret);

	return 0;
}


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

int i = 1, n, k;

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

  cin >> n >> k;

  while(n--) {
    if(2 * i > i + k) i += k;
    else i *= 2;
  }

  cout << i << '\n';

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = 999999999;
int a[2002];
int dp[2][2002];
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, z, w;
    cin >> n >> z >> w;
    REP(i, n) cin >> a[i];

    if(n == 1) cout << abs(w-a[n-1]) << "\n";
    else cout << max(abs(w-a[n-1]), abs(a[n-2]-a[n-1])) << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

ll n, s[300][300];

ll bfs(ll st){
	ll color[300];
	memset(color, 0, sizeof(color));
	queue<ll> q;
	q.push(st);
	color[st] = 1;
	ll res = 1;
	while(!q.empty()){
		ll at = q.front(); q.pop();
		rep(j, 1, n){
			if(s[at][j] == 1){
				if(color[j] == 0){
					color[j] = color[at]+1;
					res = max(color[j], res);
					q.push(j);
				}
				else{
					if(color[j]%2 == color[at]%2){
						return -1;
					}
				}
			}
		}
	}
	return res;
}

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	cin >> n;
	memset(s, 0, sizeof(s));
	string buf;
	rep(i, 1, n){
		cin >> buf;
		rep(j, 1, n){
			if(buf[j-1] == '1'){
				s[i][j] = 1;
			}
		}
	}
	
	ll ans = -1;
	rep(i, 1, n){
		ll res = bfs(i);
		ans = max(res, ans);
	}
	print(ans)
	return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <stack>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long int ll;
#define INF 1000000000

int main(){
	int n,T;
	cin>>n>>T;
	int ans = INF;
	rep(i,n){
		int c,t;
		cin>>c>>t;
		if( t <= T){
			ans = min(ans,c);
		}
	}
	if( ans == INF){
		cout<<"TLE"<<endl;		
	}else{
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 3168
#include<iostream>
#include<algorithm>

using namespace std;

int main(void)

{
    long long int n, k, i;
    cin>>n>>k;
    long long int ara[n], total = 0;
    for(i = 0; i < n; i++)cin>>ara[i];
    sort(ara, ara+n);
    for(i = 0; i < k; i++){
        total += ara[i];
    }
    cout<<total<<endl;
    return 0;
}

Measured memory_bytes: 3196
# -*- coding:utf-8 -*-
array = []
while True:
    try:
        a = int(input())
        array.append(a)
    except EOFError:
        break

data = [0]*101
for i in range(len(array)):
    data[array[i]] += 1
    
m = [i for i,j in enumerate(data) if j == max(data)]
for i in range(len(m)):
    print(m[i])

Measured memory_bytes: 7652
#include<stdio.h>
int main(){
  int a, b, c, d, e, sum = 0, average;
  scanf("%d %d %d %d %d", &a, &b, &c, &d, &e);
  if(a < 40){
    a = 40;
  }
  if(b < 40){
    b = 40;
  }
  if(c < 40){
    c = 40;
  }
  if(d < 40){
    d = 40;
  }
  if(e < 40){
    e = 40;
  }
  sum = a + b + c + d + e;
  average = sum / 5;
  printf("%d\n", average);
  return 0;
}

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

#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define fio() ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
typedef long long  ll;
const ll inf = 2147483647;
const ll MOD = 1e9 + 7;
const ll zero = 0;
const ll maxn = 1e5 + 5;
ll n, k, q, type, x, y;
ll a[maxn], dp[maxn];
ll find( ll ind ) {
	return ind / k;
}
void upd( ll ind, ll val ) { 
	ll p1 = find(ind);
	a[ind] = val;
	dp[p1] = inf;
	for ( int i = p1 * k; i < min(n, (p1 + 1) * k); i ++ ) {
		dp[p1] = min( dp[p1], a[i] );
	}	
}

ll query (ll l, ll r ) {
	ll p1 = find(l), p2 = find(r);
	ll ret = inf;
	for ( int i = p1 + 1; i < p2; i++ ) {
		ret = min(ret, dp[i]);
	}
	for ( int i = l; i < min(r, min(n, (p1 + 1) * k)); i++ ) {
		ret = min(ret, a[i]);
	}
	for ( int j = max(l, p2 * k); j <= r; j++ )
		ret = min(ret, a[j]);
	return ret;
}
int main(){
	fio();
	cin >> n >> q;
	for ( int i = 0; i < n; i ++ ) {
		a[i] = inf;
	}
	k = (int)sqrt(n);
	for ( int i = 0; i < n; i++ ) {
		dp[i] = inf;
	}
	for ( int i = 0; i < q; i++ ) {
		cin >> type >> x >> y;
		if ( type == 0 ) {
			upd(x, y);
		} else{
			cout << query(x, y) << endl;
		}
	}

	return(0);
}



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

int N, T;
int c[1005], t[1005];
int IMF = 10000;

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

    int ans = IMF;
    for (int i = 0; i < N; i++) {
        cin >> c[i] >> t[i];
        if (t[i] <= T) ans = min(ans, c[i]);
    }

    if (ans == IMF) cout << "TLE" << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 256
fn main() {
    let n = read::<usize>();
    let st = read_vec::<String>();
    let s: Vec<char> = st[0].chars().into_iter().collect();
    let t: Vec<char> = st[1].chars().into_iter().collect();
    let mut ret: Vec<char> = Vec::new();

    for i in 0..n {
        ret.push(s[i]);
        ret.push(t[i]);
    }

    println!("{}", ret.into_iter().collect::<String>());
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,count=0;
    cin >> n >> k;
    int arr[n];
    for(int i=0;i<n;++i)
    {
        cin >> arr[i];
    }
    for(int i=0;i<n;++i)
    {
        if(arr[i]>=k)
        {
            count++;
        }
    }
    cout << count;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
typedef int64_t llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define ld PRId64
#define n_max 100


float kyori(float sta,int jikan,int ma,int end,float next[]){
    if(sta + jikan <=end){
        next[0]=sta + jikan;
        return (2 * sta + jikan) * jikan /float(2);
    }
    next[0]=end;
    if(ma - sta + ma - end <= jikan) return ma * jikan - (ma - sta) * (ma -sta) /float(2) - (ma - end) * (ma - end )/float(2);
    float tim;
    tim=(end - sta + jikan )/float(2);
    return tim / float(2) * (sta + sta + tim) + (sta + tim + end) *(jikan - tim) / float(2); 
}

int main(){
    int n;
    cin >> n;
    int t[n_max+5];
    int v[n_max+5];
    REP(i,n) cin >> t[i];
    REP(i,n) cin >> v[i];
    int A[n_max+5];
    A[n-1]=0;
    REPR(i,n-2){
        A[i] = min( v[i+1] , A[i+1] + t[i+1]);
        A[i]=min(A[i] , v[i]);
    }
    float ans=0.0;
    int end;
    end=A[0];
    float sta=0;
    float next[1];
    REP(i,n){
        ans+=kyori(sta,t[i],v[i],A[i],next);
        sta=next[0];
    }
    cout << fixed << setprecision(8) << float(ans) << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
using namespace std;
using namespace __gnu_pbds;

#define sp << " " <<
#define mod 1000000007
#define PI 3.14159265358979323
#define y second
#define x first
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define pqueue priority_queue< ll >
//#define pdqueue priority_queue< ll,vector<ll> ,greater< ll > >
#define codejamDebug(x) cout<<"Case #"<<x<<": ";
#define debug(x) cout<<#x<<" :"<<x<<endl;
#define rep(i,n) for(long long i=0;i<n;i++)
#define f(i,a,b) for(long long i = a; i < b; i++)
#define fd(i,a,b) for(long long i = a; i >=b; i--)
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long int           ll;
typedef long double             ld;
typedef unsigned long long int ull;
typedef vector <int>            vi;
typedef vector <ll>            vll;
typedef pair <int, int>        pii;
typedef pair <ll, ll>          pll;
typedef vector < pii >        vpii;
typedef vector < pll >        vpll;
typedef vector <string>         vs;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//Handle:cyber_rajat

int main(int argc, char const *argv[])
{
	sync;
	string s, t;
	cin >> s >> t;
	if(sz(t)==(sz(s)+1) && s.compare(t.substr(0,sz(s)))==0){
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <list>
#include <bitset>

using namespace std;
typedef long long ll;

// #define DEBUG

class Unionfind
{
    vector<int> p;

public:
    Unionfind(int n);
    int find(int x);
    void unite(int x, int y);
    bool match(int x, int y);
};

Unionfind::Unionfind(int n)
{
    for (int i = 0; i < n; i++)
    {
        p.push_back(i);
    }
}

int Unionfind::find(int x)
{
    while (p[x] != x)
    {
        p[x] = p[p[x]];
        x = p[x];
    }
    return x;
}

bool Unionfind::match(int x, int y)
{
    return (find(x) == find(y)) ? true : false;
}

void Unionfind::unite(int x, int y)
{
    x = Unionfind::find(x);
    y = Unionfind::find(y);
    if (x != y)
    {
        p[x] = y;
    }
}

int main()
{
#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif
    int n, m, x;
    set<int> a, b, c;

    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> x;
        a.insert(x);
    }
    cin >> m;
    for (int i = 0; i < m; i++)
    {
        cin >> x;
        b.insert(x);
    }

    for (auto itr = a.begin(); itr != a.end(); itr++)
    {
        auto itr2 = b.find(*itr);
        if (itr2 == b.end())
            c.insert(*itr);
    }

    for (auto itr = c.begin(); itr != c.end(); itr++)
    {
        cout << *itr << endl;
    }

    return 0;
}

// getline(cin,s);
// a = strtok(s, ",");  ","で分解
// for (int i = 0; i < n; i++)


Measured memory_bytes: 31232
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>

using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define Yes(condition) if(condition){ cout << "Yes" << '\n'; }else{ cout << "No" << '\n'; }
#define YES(condition) if(condition){ cout << "YES" << '\n'; }else{ cout << "NO" << '\n'; }
#define yes(condition) if(condition){ cout << "yes" << '\n'; }else{ cout << "no" << '\n'; }




int main() {
    ll n, sum = 0, mx = 0;
    cin >> n;
    REP(i, n){
        ll p;
        cin >> p;
        sum += p;
        mx = max(mx, p);
    }
    cout << sum - mx / 2 << endl;
}


Measured memory_bytes: 256
/*
 * author :Sadik Hassan
 *
*/
#include "bits/stdc++.h"
using namespace std;
#define ll            long long
#define nl            "\n"
#define pb            push_back
#define fi            first
#define se            second
#define PI            (acos(-1.0))
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define rep(i,a,n)    for(int i=a;i<n;i++)
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
#define TSFL(s)       transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSFH(s)       transform(s.begin(),s.end(),s.begin(),::tolower);
typedef vector<int> vi;
typedef vector<ll> vii;
typedef set<int> si;
typedef set<ll> sii;
/*---------------------------------------------------------------------*/

const int N = 2e5+10;
const int INF = (int)1e9+5;

int main()
{
    _SAD()
    double n;
    cin>>n;
    printf("%.10f\n",2*PI*n);
    return 0;
}


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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    ll N;
    string S;
    cin >> N >> S;
    ll s = 1;
    REP(i, N - 1)
    {
        if (S[i] != S[i + 1])
            s++;
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 512
s = str(input())
ans = 0

if s=='SUN':
  ans = 7
elif s=='MON':
  ans = 6
elif s=='TUE':
  ans = 5
elif s=='WED':
  ans = 4
elif s=='THU':
  ans = 3
elif s=='FRI':
  ans = 2
elif s=='SAT':
  ans = 1
  
print(ans)


Measured memory_bytes: 2940
#090d
N,K = map(int, input().split())

#愚直解 10**5 * 10**5 = 10**10でTLEになる
#ans = 0
#for i in range(1,N+1):
#    for j in range(1,N+1):
#        if i%j>=K:
#            ans += 1
 
#i%jの表
#	j
#i	1	2	3	4	5	6	7	8	9	10	11	12	13	14	15
#1	0	1	1	1	1	1	1	1	1	1	1	1	1	1	1
#2	0	0	2	2	2	2	2	2	2	2	2	2	2	2	2
#3	0	1	0	3	3	3	3	3	3	3	3	3	3	3	3
#4	0	0	1	0	4	4	4	4	4	4	4	4	4	4	4
#5	0	1	2	1	0	5	5	5	5	5	5	5	5	5	5
#6	0	0	0	2	1	0	6	6	6	6	6	6	6	6	6
#7	0	1	1	3	2	1	0	7	7	7	7	7	7	7	7
#8	0	0	2	0	3	2	1	0	8	8	8	8	8	8	8
#9	0	1	0	1	4	3	2	1	0	9	9	9	9	9	9
#10	0	0	1	2	0	4	3	2	1	0	10	10	10	10	10
#11	0	1	2	3	1	5	4	3	2	1	0	11	11	11	11
#12	0	0	0	0	2	0	5	4	3	2	1	0	12	12	12
#13	0	1	1	1	3	1	6	5	4	3	2	1	0	13	13
#14	0	0	2	2	4	2	0	6	5	4	3	2	1	0	14
#15	0	1	0	3	0	3	1	7	6	5	4	3	2	1	0

#縦方向で周期的になっている ∴jでループさせる。
#j*(N//j) : 1 ～ j-1 , 0 までを N//j回 繰り返し。
#そこから : 1～N%j までが 1回ずつ

if K!=0:
    ans = 0
    for j in range(1,N+1): #10**5ループなのでいけるはず。
        if K <= j-1:
            ans += (j-K) * (N//j)
            if N%j >=K:
                ans += N%j - K + 1
else:
    ans = N * N

print(ans)

Measured memory_bytes: 3060
import Data.Array

calcScore :: [[Int]] -> [Int] -> Int
calcScore ctx as = do
    let ras = reverse as
    sum $ map (\ [a,b,c,d] -> if ras!!(b-1) - ras!!(a-1) == c then d else 0) ctx


solve :: Int -> Int -> [[Int]] -> [Int] -> Int
solve n m ctx as = if length as == n
                      then calcScore ctx as
                      else maximum $ map (solve n m ctx) $ map (flip (:) as) [(if as==[] then 1 else head as)..m]

main = do
    [n,m,q] <- map read . words <$> getLine :: IO[Int]
    co <- getContents
    let ctx = map (map read . words) $ lines co :: [[Int]]
    print $ solve n m ctx []


Measured memory_bytes: 5008
Cij = [list(map(int, input().split())) for _ in range(3)]

for i in range(1, 3):
    for j in range(1, 3):
        if Cij[i][j] - Cij[i][0] != Cij[0][j] - Cij[0][0]:
            print("No")
            exit()


for i in range(1, 3):
    for j in range(1, 3):
        if Cij[i][j] - Cij[0][j] != Cij[i][0] - Cij[0][0]:
            print("No")
            exit()
print("Yes")


Measured memory_bytes: 3064
import sys


def main():
    n = int(sys.stdin.readline().strip())

    def digit(num):
        if num < 10:
            return 1
        return digit(num // 10) + 1

    ans = 0
    for i in range(1, n+1):
        if digit(i) % 2:
            ans += 1
    print(ans)


main()


Measured memory_bytes: 40944
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF (1 << 30)
#define LLINF (1LL << 60)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

int intceil(int a, int b) {
    return (a + (b - 1)) / b;
}

signed main() {
    cin >> H >> W >> N;
    int mx = max(H, W);
    cout << intceil(N, mx) << endl;
}

Measured memory_bytes: 256
using System;

namespace ITP_5_D{
    public class Program{
        public static void Main(string[] args){
            string temp = Console.ReadLine();
            int num = int.Parse(temp);

            for(int i=1; i<=num; i++){
                if(i%3==0){
                    Console.Write(" "+ i);
                } else {
                    string ist = i.ToString();
                    if (ist.Contains("3")){
                        Console.Write(" "+i);
                    }
                }
            }
            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 9788
#include <bits/stdc++.h>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> tup;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vp;
int main(int argc,char const* argv[])
{
  int ans1=0,ans2=0;
  string s;
  cin  >> s;
  int n=int(s.size());
  for(int i=0;i<n;i++)
    {
      if(i%2==0)
	{
	  if(s[i]=='0') ans1++;
	  else ans2++;
	}
      else
	{
	  if(s[i]=='1') ans1++;
	  else ans2++;
	}
    }
  cout << min(ans1,ans2) << endl;
  return 0;
}


Measured memory_bytes: 512