akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#define INF 999999999

using namespace std;

int n, s, ans;
int a;
int d[105000];


int main()
{
	scanf("%d %d", &n, &s);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a);
		d[i] = d[i - 1] + a;
		
	}
	
	if (d[n] < s) {
		printf("0\n");
		return 0;
	}

	ans = n;
	for (int i = 0; d[i] + s <= d[n]; i++) {
		int j = lower_bound(d + i, d + n, d[i] + s) - d;
		ans = min(ans, j - i);
	}
	printf("%d\n", ans);

	return 0;
}

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

int main(){
  string a,b;
  int c = 0;
  cin >> a >> b;
  if (a[0] == b[0]) c = c + 1;
  if (a[1] == b[1]) c = c + 1;
  if (a[2] == b[2]) c = c + 1;
  cout << c;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define int long long
#define ll  long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define BS binary_search
#define all(c) (c).begin(),(c).end()
#define deb(a) cout<<#a<<" "<<a<<endl
#define WW 100000
#define INF 1000000000000000000 //1e18
#define EPS 0.000000001 //1e-9
//get<a>(t) gives ath element of tuple named t, numbering starts from 0
//max({_,......,_}) can give maximum of any number of elements. Similarly min also.
//don't forget to initialise freq arrays
//reverse(all(v)) would reverse a vector  
//pow(10.0, 2.0) can give exactly 100.0, slightly greater, or slightly less. 
//Therefore use(int)(pow(10.0,zz)+EPS)
int32_t main()
{
    IOS;
    int n,m; cin>>n>>m;
    int sum=0;
    for(int i=0;i<m;i++)
        {int x; cin>>x; sum+=x;}
    
    cout<<max(n-sum,-1LL);
    return 0;
}

Measured memory_bytes: 3656
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = int64_t;
using ull = uint64_t;
using PLL = pair<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

ll query(ll u, ll v) {
    cout << "? " << u << ' ' << v << endl << flush;
    ll ret;
    cin >> ret;
    return ret;
}

int main() {
    ll N, S, T;
    cin >> N >> S >> T;
    V<PLL> nodes;
    ll dist = query(S, T);
    for(ll i = 1; i <= N; i++) {
        if(i == S || i == T) continue;
        ll d1 = query(S, i);
        ll d2 = query(i, T);
        if(d1 + d2 == dist) nodes.emplace_back(d1, i);
    }
    sort(ALL(nodes));
    nodes.emplace_back(dist, T);
    ll cur = S;
    ll cur_dist = 0;
    V<ll> ans = { S };
    for(auto &&ele : nodes) {
        ll d, n;
        tie(d, n) = ele;
        ll diff = d - cur_dist;
        if(query(cur, n) != diff) continue;
        cur = n;
        cur_dist = d;
        ans.push_back(cur);
    }

    cout << '!';
    for(auto &&ele : ans) cout << ' ' << ele;
    cout << endl << flush;
    return 0;
}



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

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, n, m) for (int i = n; i < m; i++)
#define ll long long int

using namespace std;

int main()
{
  int n;
  int p[10];
  cin >> n;
  REP(i,n) {
    cin >> p[i];
  }
  sort(p, p+n, greater<int>());
  int result = p[0]/2;
  FOR(i,1,n) {
    result += p[i];
  }

  cout << result << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX(x,y) ((x>y)?x:y)

char x[260][260];
int main(){
	int i,j,n,ans,a,b,c,d;
	
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		memset(x,0,sizeof(x));
		for(i=0;i<n;i++)scanf("%s",x[i]);
		ans=0;
		for(i=0;i<n;i++){
			a=b=c=d=0;
			for(j=0;j<n;j++){
				if(x[i][j]=='1')a++;
				else{ans=MAX(ans,a);a=0;}
				
				if(x[j][i]=='1')b++;
				else{ans=MAX(ans,b);b=0;}
				
				if(j<=i){
					if(x[i-j][j]=='1')c++;
					else{ans=MAX(ans,c);c=0;}
					
					if(x[i-j][n-1-j]=='1')d++;
					else{ans=MAX(ans,d);d=0;}
					
					if(j==i){
						ans=MAX(ans,c);
						ans=MAX(ans,d);
						c=d=0;
					}
				}
				else{
					if(x[n+i-j][j]=='1')c++;
					else{ans=MAX(ans,c);c=0;}
					
					if(x[n+i-j][n-1-j]=='1')d++;
					else{ans=MAX(ans,d);d=0;}
				}
			}
			ans=MAX(ans,a);
			ans=MAX(ans,b);
			ans=MAX(ans,c);
			ans=MAX(ans,d);
		}
		printf("%d\n",ans);
	}
	
	return 0;
}

Measured memory_bytes: 0
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        ss: [chars; n]
    }
    let mut v1 = vec![];
    let mut v2 = vec![];
    for s in &ss {
        let mut t = 0;
        let mut p = 0;
        for &c in s {
            if c == '(' {
                t += 1;
            } else {
                t -= 1;
            }
            p = max(p, -t);
        }
        if t >= 0 {
            v1.push((t, p));
        } else {
            v2.push((t, p));
        }
    }
    v1.sort_by_key(|x| x.1);
    let mut d: i64 = 0;
    for &(t, p) in &v1 {
        if d < p {
            println!("No");
            return;
        }
        d += t;
    }
    v2.sort_by_key(|x| - x.1 - x.0);
    for &(t, p) in &v2 {
        if d < p || d + t < 0 {
            println!("No");
            return;
        }
        d += t;
    }
    if d != 0 {
        println!("No");
    } else {
        println!("Yes");
    }
}


Measured memory_bytes: 72540
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int a[300000],a2[300000],flg[300000],x[300000],y[300000];
int main(void)
{
	int n,m,i,q,cnt,b,x1,y1,wk,ans,f;
	scanf("%d",&n);
	for(i=0;i<n;i++)		{
		scanf("%d",&a[i]);
		a2[i]=a[i];
	}
	sort(a2,a2+n);
//	printf("aaa\n");
	cnt=0;
	for(i=0;i<n;i++)	{
		if(a[i]==a2[i])	flg[i]=0;
		else flg[i]=1;
		cnt+=flg[i];
	}
//	printf("cnt=%d\n",cnt);
	scanf("%d",&q);
	for(i=0;i<q;i++)	scanf("%d %d",&x[i],&y[i]);
	if(cnt==0)	{	
		ans=0;	
		f=1;
	}
	else {
		f=0;
		for(i=0;i<q;i++)	{

			x1=x[i]-1;	y1=y[i]-1;
			wk=flg[x1]+flg[y1];
			swap(a[x1],a[y1]);
			if(a[x1]==a2[x1])	flg[x1]=0;
			else flg[x1]=1;
			if(a[y1]==a2[y1])	flg[y1]=0;
			else flg[y1]=1;
			cnt=cnt-wk+flg[x1]+flg[y1];
			if(cnt==0)	{
				ans=i+1;	break;	
			}
		}
	}
	if(i==q && f==0)	printf("-1\n");
	else printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 8644
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] c = sc.next().toCharArray();
        if (c[2] == c[3] && c[4] == c[5])
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}

Measured memory_bytes: 35576
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    P = il()
    ret = 0
    for n in range(1, N - 1):
        if P[n - 1] < P[n] < P[n + 1] or P[n - 1] > P[n] > P[n + 1]:
            ret += 1
    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 10096
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
  
int main(void){
  string in;
  const char* delim = ",";
  int rowsize = 0;
  int colsize = 0;
  vector<vector<int> > d;
  while(getline(cin,in)){
    char s[1000];
    vector<int> tmp;
    strcpy(s,in.c_str());
    for(const char *token=strtok(s,delim);token;token=strtok(0,delim)){
      int t = atoi(token);
      tmp.push_back(t); 
    }
    d.push_back(tmp);
    rowsize = max(rowsize,(int)tmp.size());
    colsize++;
  }
  vector<int> dp(rowsize+1);
  vector<int> dp2(rowsize+1);
  REP(i,(colsize+1)/2){
    vector<int> ndp = dp;
    vector<int> ndp2 = dp2;
    REP(j,i+1){
      ndp[j+1] = d[i][j] + max(dp[j],dp[j+1]);
      ndp2[j+1] = d[colsize-1-i][j] + max(dp2[j],dp2[j+1]);
    }
    dp = ndp;
    dp2 = ndp2;
  }
  int ans = 0;
  REP(i,rowsize){
    ans = max(ans, dp[i+1]+dp2[i+1]-d[colsize/2][i]);
  }
  cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 0
#include<stdio.h>

int main(void)
{
  int num;
  int i;

  scanf("%d", &num);

  for(i=1;i<=num;i++)
    {
      if (i%3==0)
	printf(" %d", i);
      else if (i%10==3)
	printf(" %d", i);
      else if (i/10==3)
	printf(" %d", i);
      else if (i/10%10==3)
	printf(" %d", i);
      else if (i/10/10%10==3)
	printf(" %d", i);
      else if (i/100==3)
	printf(" %d", i);
      else if (i/1000==3)
	printf(" %d", i);
    }

  printf("\n");

  return 0;
}

Measured memory_bytes: 600
import sys
import os
import itertools


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.readline().rstrip())
    P = tuple(map(int, sys.stdin.readline().split()))
    Q = tuple(map(int, sys.stdin.readline().split()))

    seq = []
    for n in range(N):
        seq.append(n + 1)

    allcase = list(itertools.permutations(seq))
    ret = []
    for i, case in enumerate(allcase):
        if case == P:
            ret.append(i)
        if case == Q:
            ret.append(i)

    print(abs(ret[0] - ret[1]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 8052
#include<iostream>
using namespace std;
int main()
  {
  int A,B,C;
  cin>>A>>B>>C;
  int is=0;
  if((A<=9 && A>=1) && (B<=9 && B>=1) && (C<=9 && C>=1))
    {
  if(A==B && B!=C)
    is=1;
 if(A==C && C!=B)
    is=1;
  if(C==B && B!=A)
    is=1;
    
  if(is)
    cout<<"Yes";
  else
    cout<<"No";
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		int z = sc.nextInt();
		int num = 0;

		while ((y + z) * num + z <= x) {
			num++;
		}

		System.out.println(num-1);
	}
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++) {cin>>arr[i];
        if(arr[i]%2==0 and (arr[i]%3!=0 and arr[i]%5!=0)){
            cout<<"DENIED"<<endl;
            return 0;
        }
    }
    cout<<"APPROVED"<<endl;

    return 0;
}

Measured memory_bytes: 256
/**
*	  Name: Ajay
*	  Institute: IIITH 
*/

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <ctime>
#include <string.h>
#define ll long long
#define inf 0x7fffffff
#define mod 1000000007
#define pb push_back
#define ppi pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vii vector<ppi>
#define vll vector<ll>
#define mp make_pair
#define fi first
#define se second
using namespace std;

void fastio()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void input()
{
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
}

int main()
{      
  fastio();
  char a,b;
  cin>>a>>b;
  int at=a-'0';
  int bt=b-'0';
  long long aval,bval;
  string as="",bs="";
  for(int i=0;i<at;i++){
     bs+=b;
  }
  for(int i=0;i<bt;i++){
     as+=a;
  }
  
  if(as<bs)
    cout<<as;
  else
    cout<<bs;
  return 0;
}

Measured memory_bytes: 256
mod = 10 ** 9 + 7

N = int(input())
A = [(int(input()), -1) for _ in range(N)]
B = [(int(input()), 1) for _ in range(N)]

C = sorted(A + B)

res = 1
cnt = 0
for _, delta in C:
    if cnt != 0 and (cnt > 0) != (delta > 0):
        res *= abs(cnt)
        res %= mod
    cnt += delta

print(res)

Measured memory_bytes: 28936
#include <stdio.h>
int main(void){
    // Your code here!
    int a,b;
    scanf("%d %d",&a,&b);
    
    int ketab;
    int bb=b;
    while(bb){
        bb/=10;
        //ketab++;
        a*=10;
    }
    
    //int s=a*pow(10,ketab)+b;
    int s=a+b;    
    
    if( pow( (int)sqrt((double)s) ,2)==(double)s   ){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    
    
}

Measured memory_bytes: 2052
N = int(input())
a = list(map(int,input().split()))
b = []

for i in range(N):
    a_2 = 0
    while a[i]%2 == 0:
        a[i] = a[i]//2
        a_2 += 1
    b.append(a_2)
print(sum(b))


Measured memory_bytes: 10108
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;

int main() {
    long long N, D, X, Y;
    int cnt = 0;
    double  tmp;
    
    cin >> N >> D;
    
    for ( int ii = 0; ii < N; ii++ ) {
        cin >> X >> Y;
        tmp = sqrt(X * X + Y * Y);
        if ( (double)D - tmp > -1.0e-9 ) {
            cnt++;
        }
    }
    
    cout << cnt << endl;
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi = vector<int>;
using vl= vector<ll>;
using vs=vector<string>;

ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a);}
ll max(ll a, ll b) {if (a > b) return a; else return b;}
ll min(ll a, ll b) {if (a < b) return a; else return b;}
ll power(ll a,ll b) {ll i,p=1; for(i=0;i<b;i++){p*=a;} return p;}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int testcase=1;
    //cin>>testcase;
    for(int p=0;p<testcase;p++){
	string s;
	cin>>s;
	ll counter=0;
	for(int i=0;i+1<s.size();i++){
if((s[i]=='A' && s[i+1]=='B')||(s[i]=='B' && s[i+1]=='A'))
counter++;
}
if(counter!=0)
cout<<"Yes";
else
cout<<"No";


        }

    return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace         std;
#define                 int long long
#define                 pb push_back
#define                 mp make_pair
#define st(arr,a)       memset(arr,a,sizeof arr)
#define                 nl cout<<endl
#define                 real signed
#define                 endl '\n'              
#define bitcount(x)     __builtin_popcountll(x)
const int MOD = 1000000007ll;
#define forn(i,a,b)     for(int i=a;i<=b;i++)
#define rfor(i,a,b)     for(int i=a;i>=b;i--)
#define all(x)          x.begin() , x.end()
#define pi pair<int,int>
#define X first
#define Y second
//#define N 314159
#define  vi vector<int>
#define  v  vector

int arr[22][22];
int n;
int dp[1LL<<22];
const int N = 1LL<<22;
signed main() 
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
    cin>>n;
    forn(i,0,n-1)forn(j,0,n-1)cin>>arr[i][j];
    dp[0] = 1;
   // forn(i,0,7)cout<<dp[i]<<" ";
    forn(mask,0,(1LL<<n)-2)
    {
        int x = __builtin_popcountll(mask);
        forn(j,0,n-1)
        {
            if((mask&(1LL<<j))==0  and arr[x][j])
            {
                //cout<<"h";
                dp[mask^(1LL<<j)] = (dp[mask^(1LL<<j)] + dp[mask])%MOD;
            }
        }
    }
    
   // forn(i,0,7)cout<<dp[i]<<" ";
    
    cout<<dp[(1LL<<n)-1];
    
    



    return 0;

}

//       g++ -g c.cpp ; ./a.exe

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

using namespace std;

int main() {
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a+3);
	if (a[0] == 5 && a[1] == 5 && a[2] == 7) {
		cout << "YES\n";
	}
	else {
		cout << "NO\n";
	}
}

Measured memory_bytes: 256
n, m, x = map(int, input().split())

posibilities = []

for _ in range(n):
    book = list(map(int, input().split()))
    b = posibilities[:]
    for i in b:
        posibilities.append([z+y for z, y in zip(i, book)])
    posibilities.append(book)

posibilities.sort(key=lambda i: i[0])

for i in posibilities:
    for j in i[1:]:
        if j < x:
            break
    else:
        print(i[0])
        break
else:
    print(-1)

#left = -1
#right = len(posibilities)-1
#
#while right-left > 1:
#    mid = (left+right)//2
#    for i in posibilities[mid][1:]:
#        if i < x:
#            left = mid
#            break
#    else:
#        right = mid
#
#for i in posibilities[right]:
#    if i < x:
#        print(-1)
#        break
#else:
#    print(posibilities[right][0])


Measured memory_bytes: 11508
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int d,r;
	long int a,b;
	double f;
	cin>>a>>b;
	d=a/b;
	r=a%b;
	f=(double)a/b;
	cout<<d<<" "<<r<<" ";
        printf("%.5lf\n",f);
	return 0;
}


Measured memory_bytes: 3236
a = Array.new(32)
a[0] = 1
a[1] = a[0]
a[2] = a[0] + a[1]
(3..32).each{|i|
  a[i] = a[i-1] + a[i-2] + a[i-3]
}

while true do
  n = gets.to_i
  break if n.zero?  
  puts ((a[n] + 9) / 10 + 364) / 365
end

Measured memory_bytes: 8664
const MOD = Int(10^9+7)

function solve()
    N = parse(Int, readline())
    A = parse.(Int, split(readline()))

    S = 0
    for i = 1:N
        S = (S+A[i])%MOD
    end

    res = 0
    for i = 1:(N-1)
        S = (S-A[i])%MOD
        res += (A[i]*S)%MOD
    end

    println((res%MOD + MOD)%MOD)
end

solve()


Measured memory_bytes: 199816
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)


void solve(long long N, std::vector<long long> A){
    ll minA=1LL<<50, sum=0, cnt=0;
    rep(i, N){
        sum += abs(A[i]);
        minA = min(minA, abs(A[i]));
        if(A[i]<0)
            cnt++;
    }
    if(cnt %2)
        cout << sum - 2*minA<<endl;
    else
    {
        cout << sum << endl;
    }
    
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<iomanip>
#include<sstream>
#include<map>
#include<set>
#include<cmath>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
	std::fill((T*)array, (T*)(array + N), val);
}
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1;i <=n;i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
typedef long long ll;
typedef long double ld;
typedef unsigned long long int ull;
const ll INF = 1LL << 60;
const int inf = 1 << 25;
int main(void) {
	int N; ll K, L, R; cin >> N >> K >> L >> R;
	vector<ll> a(N);
	rep(i, N) cin >> a[i];
	int M = N / 2; vector<vector<ll>> x(41);
	rep(i, 1 << M) {
		int cnt = 0; ll add = 0;
		rep(j, M) {
			if ((i >> j) & 1) cnt++,add += a[j];
		}x[cnt].push_back(add);
	}
	rep(i, M + 1) {
		sort(ALL(x[i]));
	}ll ans = 0;
	rep(i, 1 << (N - M)) {
		ll add = 0; int cnt = 0;
		rep(j, (N - M)) {
			if ((i >> j) & 1) cnt++, add += a[j + M];
		}
		if (cnt > K) continue;
		ans += upper_bound(ALL(x[K - cnt]), R - add) - lower_bound(ALL(x[K - cnt]), L - add);
	}cout << ans << endl;
}


Measured memory_bytes: 12320
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

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

    int cnt=0, ans=0;
    for(int i=1; i<n; i++) {
        if(h[i-1]<h[i]) {
            ans = max(cnt, ans);
            cnt = 0;
        } else {
            cnt++;
            ans = max(cnt, ans);
        }
    }

    cout << ans << endl;

    return 0;
}

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

class Vector2 {
public:
  double x, y;

  Vector2(): x(0), y(0) {}
  Vector2(double x, double y): x(x), y(y) {}

  Vector2 operator+(Vector2 p) { return Vector2(x + p.x, y + p.y); }
  Vector2 operator-(Vector2 p) { return Vector2(x - p.x, y - p.y); }

  Vector2 operator*(double t) { return Vector2(x * t, y * t); }
  Vector2 operator/(double t) { return Vector2(x / t, y / t); }

  double dot(Vector2 p) { return x * p.x + y * p.y; }
  double det(Vector2 p) { return x * p.y - y * p.x; }

  double norm2() { return x * x + y * y; }
  double norm() { return sqrt(norm2()); }

  Vector2 normalize() { return Vector2(x / norm(), y / norm()); }

  friend ostream& operator<<(ostream &out, const Vector2 &v) {
    out << "(" << v.x << ", " << v.y << ")";
  }
};
using Point2 = Vector2;

bool line_segments_intersect(Point2 a, Point2 b, Point2 c, Point2 d) {
  double ta = (a - c).det(d - c);
  double tb = (b - c).det(d - c);
  double tc = (c - a).det(b - a);
  double td = (d - a).det(b - a);
  return ta * tb < 0 && tc * td < 0;
}

class Dijkstra {
public:
  struct edge {
    ll v;
    double dist;
  };

  struct state {
    ll v;
    double cost;
    bool operator>(const state s) const { return cost > s.cost; }
  };

  const double INF = 1e20;
  ll N;
  vector< vector<edge> > E;

  Dijkstra(ll n): N(n), E(n) {}

  void add_undirected_edge(ll u, ll v, double d) {
    E[u].push_back((edge) { v, d });
    E[v].push_back((edge) { u, d });
  }

  vector<double> shortest_path(ll S) {
    vector<double> dp(E.size(), INF);
    priority_queue<state, vector<state>, greater<state> > q;
    q.push((state) { S, 0 });
    while(!q.empty()) {
      ll v = q.top().v;
      double cost = q.top().cost;
      q.pop();
      if(dp[v] <= cost) continue;
      dp[v] = cost;
      REP(i, 0, E[v].size()) {
        ll nv = E[v][i].v;
        double ncost = cost + E[v][i].dist;
        if(dp[nv] > ncost) q.push((state) { nv, ncost });
      }
    }
    return dp;
  }
};

int main(void) {
  ll N, M;
  cin >> N >> M;
  vector<Point2> A(N), B(M);
  REP(i, 0, N) cin >> A[i].x >> A[i].y;
  REP(i, 0, M) cin >> B[i].x >> B[i].y;

  if(!line_segments_intersect(A[0], A[1], B[0], B[1])) {
    printf("%.15lf\n", (A[1] - A[0]).norm() + (B[1] - B[0]).norm());
    return 0;
  }

  Dijkstra dijkA(N);
  REP(i, 0, N) REP(j, i + 1, N) {
    if(!line_segments_intersect(A[i], A[j], B[0], B[1])) {
      dijkA.add_undirected_edge(i, j, (A[j] - A[i]).norm());
    }
  }
  double ansA = dijkA.shortest_path(0)[1] + (B[1] - B[0]).norm();

  Dijkstra dijkB(M);
  REP(i, 0, M) REP(j, i + 1, M) {
    if(!line_segments_intersect(B[i], B[j], A[0], A[1])) {
      dijkB.add_undirected_edge(i, j, (B[j] - B[i]).norm());
    }
  }
  double ansB = dijkB.shortest_path(0)[1] + (A[1] - A[0]).norm();

  const double EPS = 1e-10;
  if(ansA >= 1e20 - EPS && ansB >= 1e20 - EPS) {
    cout << -1 << endl;
  } else {
    printf("%.15lf\n", min(ansA, ansB));
  }
}



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

int main(void)
{
double A, B, taxA, taxB, ansA, ansB, ANS;
  scanf("%lf %lf", &A, &B);
  for (ANS = 1.0; ANS <= 1000.0; ++ANS) {
    taxA = floor(ANS * 0.08);
    taxB = floor(ANS * 0.1);

    if (taxA == A && taxB == B) {
      printf("%.0lf\n", ANS);
      return 0;
    }
  }
  printf("-1\n");
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    int N;
    cin>>N;
    vi v(N);
    rep(i,N) cin>>v.at(i);
    sort(v.begin(),v.end());
    double counter=0;
    counter+=v.at(0);
    counter+=v.at(1);
    counter/=2;
    if(N==2) {
        cout<<fixed<<setprecision(7);
        cout<<counter<<endl;
    }
    else {
        for(int i=2; i<N; i++) {
            counter+=v.at(i);
            counter/=2;
        }
        cout<<fixed<<setprecision(7);
        cout<<counter<<endl;
    }
}

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

struct Restaurant {
  string s;
  int p;
  int i;
  Restaurant(){};
  Restaurant(string _s, int _p, int _i) {
    s = _s;
    p = _p;
    i = _i;
  };
  bool operator<(const Restaurant& o) const {
    return tie(s, o.p) < tie(o.s, p);
  }
};

int main() {
  int n;
  cin >> n;
  vector<Restaurant> r(n);
  for (int i = 0; i < n; i++) {
    cin >> r[i].s >> r[i].p;
    r[i].i = i;
  }
  sort(begin(r), end(r));
  for (auto&& u : r) cout << u.i + 1 << endl;
}

Measured memory_bytes: 256
n=int(input())
a=[int(input())for i in range(n)]
c=0
l=[]
l2=[]
for i in a:
    if i!=0:
        l.append(i)
    else:
        l2.append(sum(l)//2)
        l=[]
l2.append(sum(l)//2)
print(sum(l2))

Measured memory_bytes: 7844
# def smxor(a,b):
#   if a+b == a^b:
#     return True
#   else:
#     return False
n = int(input())
a = list(map(int,input().split()))
xor = a[0]
sm = a[0]
r = 1
ans = 0
for l in range(n):
  if l == r:
    xor = a[r]
    sm = a[r]
    r += 1
  while sm == xor and r <= n-1:
    xor = xor^a[r]
    sm = sm+a[r]
    ans += r-l
    r += 1
  if sm == xor:
    ans += 1
  xor = xor^a[l]
  sm = sm-a[l]
print(ans)

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

#define     fast()              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define     ll                  long long int
#define     test()              ll t; cin>>t; while(t--) 
#define     lp0(i,begin,end)    for(ll i=begin;i<end;i++)
#define     lp1(i,begin,end)    for(ll i=begin;i<=end;i++)
#define     rlp(i,begin,end)    for(ll i=end;i>=begin;i--)
#define     prec(n)             fixed<<setprecision(n)
#define     initial(a,i)        memset(a,i,sizeof(a))
#define     pb                  push_back
#define     PI                  3.1415926535897932384626433832795
#define     MOD                 1000000007
#define     F                   first
#define     S                   second
#define     all(a)              (a).begin(),(a).end()
#define     BPC(x)              __builtin_popcountll(x)
#define     gcd(a,b)            __gcd(a,b)

ll gcd(ll a,ll b) {if (a==0) return b;return gcd(b%a,a);}

ll power(ll x,ll n)
{
    ll result = 1;
    while (n)
    {
        if (n & 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}


// Solution Function
void solution(ll compte)
{
    // cout<<compte<<"\n";
    ll n;
    cin>>n;
    cout<<((n/2)*(n-(n/2)))<<endl;
}

// Driver Function
int main()
{
    ll compte = 1;
   // test()
    //{
        solution(compte);
        compte++;
    //}
    return 0;
}


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

int main() {
  int n; cin >> n;
  vector<int> a(n);
  // aの取りうる値が答えかどうかをチェックスルためのbool配列
  vector<bool> isND(1e6+100,false);
  for(int i=0; i<n; i++) {
    cin >> a[i];
    // 該当する数はonにする
    isND[a[i]] = true;
  }
  sort(a.begin(), a.end());

  int ans;
  // 配列サイズが1ならそもそも成立しない
  if((int)a.size()==1) ans=1;
  else {
    // 全ての要素について、倍数の要素を消していく
    for(int i=0; i<(int)a.size(); i++) {
      // 既に消去済みなら飛ばす
      if(!isND[a[i]]) continue;
      else {
        // aの要素の倍数
        int multiple;
        // 選択中の要素が複数あるものなら、1倍でも消去
        if(a[i]==a[i+1] && i<(int)a.size()-1) isND[a[i]] = false;
        for(int j=2;;j++) {
          multiple = a[i]*j;
          if(multiple > a.back()) break;
          else isND[multiple] = false;
        }
      }
    }
    ans = count(isND.begin(), isND.end(), 1);
  }
  cout << ans << endl;
}


Measured memory_bytes: 4256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
int N;
int M;
int A[10000];
int main(){
  rd(N);
  rd(M);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=(0);Lj4PdHRW<(M);Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  {
    int e98WHCEY;
    int cTE1_r3A;
    if(M==0){
      cTE1_r3A = 0;
    }
    else{
      cTE1_r3A = A[0];
      for(e98WHCEY=(1);e98WHCEY<(M);e98WHCEY++){
        cTE1_r3A += A[e98WHCEY];
      }
    }
    N -=cTE1_r3A;
  }
  if(N < 0){
    N = -1;
  }
  wt_L(N);
  wt_L('\n');
  return 0;
}
// cLay varsion 20200419-1

// --- original code ---
// int N, M, A[1d4];
// {
//   rd(N,M,A(M));
//   N -= sum(A(M));
//   if(N < 0) N = -1;
//   wt(N);
// }


Measured memory_bytes: 3672
/* include c++ libraries */
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <queue>
#include <set>

/* include c-lang libraries */
#include <climits>
#include <cmath>

/* include my libraries */
//#include <show_vec.hh>

using namespace std;

#define LINE DEBUG{ printf("LINE : %d\n", __LINE__); }
#define DEBUG if(false)

using ll = long long;
template<class T> using vec = vector<T>;

const int MOD = 1000000007;

int main(){
  ll N, M, K;
  cin >> N >> M >> K;
  vec<ll> A(N), Asum(N+1, 0);
  vec<ll> B(M), Bsum(M+1, 0);
  for(int i = 0; i < N; i++){
    cin >> A[i];
    Asum[i+1] = A[i] + Asum[i];
  }
  for(int i = 0; i < M; i++){
    cin >> B[i];
    Bsum[i+1] = B[i] + Bsum[i];
  }

  int a = N;
  int b = 0;
  int max = 0;
  while(a >= 0 && b <= M){
    if(Asum[a]+Bsum[b] <= K){
      max = (max<a+b)? a+b: max;
      b++;
      continue;
    }
    if(Asum[a]+Bsum[b] > K){
      a--;
      continue;
    }
  }

  cout << max << endl;




  return 0;
}


Measured memory_bytes: 9572
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define MOD7 1000000007
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
    int N;
    cin >> N;
    vector<int> H(N);
    for(int i = 0; i < N; i++) cin >> H[i];
    if(N == 1){
        puts("0");
        return 0;
    }
    vector<int> move_n(N);
    int move = 0;
    for(int i = N - 1; i>= 1; i--){
        move_n[i] = move;
        if(H[i-1] >= H[i]) move++;
        else move = 0;
    }
    if(H[0] >= H[1]) move_n[0] = move_n[1]+1;
    else move_n[0] = 0;
    
    int max_n = 0;
    for(int a : move_n) max_n = max(max_n, a);
    cout << max_n<< endl;
}

Measured memory_bytes: 3964
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b,c,d,e,n,ans = 0;
  string s,ss,sss;
  cin>>n>>a>>b;
  ll sum = a+b;
  ll cnt = n/sum;
  ans += cnt*a;
  n%=sum;
  cout<<ans+min(a,n)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
using namespace std;
const constexpr int INF = 1e9;
//typedef std::pair<std::string,double> P;

#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef vector<int> VI;
const constexpr ll MOD = 1e9+7;
 
struct Less {
    bool operator()(const pair<int, int>& x, const pair<int, int>& y) const {
        return x.first > y.first;
    }
};

ll GCD(ll a, ll b){
    if(b==0) return a;
    return GCD(b, a%b);
}


//グラフの隣接リスト
VI g[200010];
//頂点の入次数を管理
int h[100010];

ll N, X;
ll x[100010];
int main(){
    cin >> N >> X;
    REP(i, N) {
        cin >> x[i];
        x[i] = abs(x[i]-X);
    }
    ll ans=x[0];
    for(int i=0; i<N; ++i){
        if(ans<x[i]) ans =GCD(x[i], ans);
        else ans = GCD(ans, x[i]);
    }
    cout << ans << endl; 
    return 0;
}

Measured memory_bytes: 5760
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		int n = input.nextInt();
		int[] a = new int[100];
		
		for (int i=0;i<n;i++)
		{
			a[i] = input.nextInt();
		}
		
		int sum = 0;
		for (int i=1;i<n;i++)
		{
			if (a[i]==a[i-1])
			{
				sum++;
				a[i] = 100+sum;
				
			}
		}
		
		System.out.println(sum);

	}

}


Measured memory_bytes: 21204
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>

#include <climits>
#include <cmath>
#include <cstring>

#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;
typedef unsigned long long int ull;


bool checkMid(ll n , ll m , ll mid)
{
	if(mid > n)
		m -= 2*(mid-n);
	return m>=2*mid;
}

int main()
{
	FAST;
	ll n,m;
	cin >> n >> m;

	ll l=0,r=1e12;
	ll ans = 0;
	while(l <= r)
	{
		ll mid = ((l+r) >> 1);
		if(checkMid(n , m , mid))
		{
			ans = mid;
			l = mid + 1;
		}
		else
			r = mid - 1;
	}

	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

using namespace std;
#define MAX 500000
int temp[MAX], count;

void merge(int A[], int lo, int mid, int hi) {
    for(int i = lo; i <= hi; i++) {
        temp[i] = A[i];
    }
    int i = lo, j = mid+1;
    for(int k = lo; k <= hi; k++) {
        count++;
        if(i > mid) {
            A[k] = temp[j++];
        }
        else if(j > hi) {
            A[k] = temp[i++];
        }
        else if(temp[i] <= temp[j]) {
            A[k] = temp[i++];
        }
        else {
            A[k] = temp[j++];
        }

    }
}

void mergeSort(int A[], int lo, int hi) {
    if(lo >= hi) return;
    int mid = (lo + hi) / 2;
    mergeSort(A, lo, mid);
    mergeSort(A, mid+1, hi);
    merge(A, lo, mid, hi);
}

int main()
{
    int n;
    int A[MAX];
    scanf("%d", &n);
    for(int i = 0; i < n; i++) {
        scanf("%d", &A[i]);
    }
    mergeSort(A, 0, n-1);
    for(int i = 0; i < n; i++) {
        printf("%d", A[i]);
        if(i != n-1) printf(" ");
    }
    printf("\n%d\n", count);
    return 0;
}

Measured memory_bytes: 6468
using System;

namespace B
{
	class Program
	{

		// 初項a, 公差d, 項数nの等差数列の和
		public static long sumN(int a, int d, int n){
			return (long)n * (2 * a + (n - 1) * d) / 2;
		}


		static void Main(string[] args)
		{
			int N = int.Parse(Console.ReadLine());

			long ans = sumN(1,1,N) - sumN(3,3,N/3) - sumN(5,5,N/5) + sumN(15,15,N/15);

			Console.WriteLine(ans);

		}
	}
}


Measured memory_bytes: 27520
#include <stdio.h>

int main()
{
  int n,q,i,L,R,M,onaji=0;

  scanf("%d",&n);
  int S[n];
  for(i=0;i<n;i++)scanf("%d",&S[i]);

  scanf("%d",&q);
  int T[n];
  for(i=0;i<q;i++)scanf("%d",&T[i]);

 

  for(i=0;i<q;i++)
    {
      L=0;
      R=n;
       if(T[i]<=S[n-1]&&T[i]>=S[0])
	 {
	   while(L<R)
	     {
	       M=(L+R)/2;
	       if(S[M]==T[i])
		 {
		   onaji++;
		   break;
		 }
	       else if(T[i]<S[M])R=M;
	       else L=M+1;
	     }
	 }
    }
  
  printf("%d\n",onaji);
  return 0;
}



Measured memory_bytes: 2284
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9 + 7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))


def main():
    s = S()
    l = len(s)
    d,p = 0,1
    for c in s:
        if c == '1':
            d,p = (d*3+p) % mod, p*2 % mod
        else:
            d,p = d*3 % mod, p

    return (d+p) % mod


print(main())



Measured memory_bytes: 5460
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <complex>
#include <fstream>
#include <cmath>

using namespace std;

int main(void){
    string a, b, c;
    cin >> a >> b >> c;
    if((a.back() == b.front()) && b.back() == c.front()){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll mod = 1000000007;

const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;

template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}



// check
// 問題文を復唱する


int main() {
  ll n,k,h,w,m;
  cin >> n >>m;
  // string s;
  // cin >> s;
  vector<ll> l(m,0);
  vector<ll> r(m,0);
  vector<pair<ll,ll>> lr(m);
  // cin >> a;

  for (int i = 0; i < m; i++) {
      cin >> l[i] >>r[i];
      l[i]--;
      r[i]--;
      lr[i] = make_pair(l[i],r[i]);
  }

  // sort(lr.begin(),lr.end(),[]( pair<ll,ll> &left, pair<ll,ll> &right ){
  //   return left.second < right.second;
  // });


  // sort(lr.begin(),lr.end(),[]( pair<ll,ll> &left, pair<ll,ll> &right ){
  //   return left.first < right.first;
  // });


  sort(l.begin(),l.end(),greater<ll>());
  sort(r.begin(),r.end());


  ll ans = 0;

  if (r[0] - l[0] >= 0) ans = r[0] - l[0] + 1;

  // for (int i = 0; i < n; i++) {
      
  // }



  cout << ans <<endl;

  
  // cout << (true? "Yes":"No");


}




















Measured memory_bytes: 3328
def findProductSum(A, n): 
      
    array_sum = sum(A)
    array_sum_square = array_sum ** 2
    
    individual_square_sum = 0
    for i in range(n): 
        individual_square_sum += A[i] * A[i] 
  
    return (array_sum_square - individual_square_sum) // 2

N = int(input())
A = list(map(int, input().split()))

print(findProductSum(A, N)%(10**9+7))


Measured memory_bytes: 94328
//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <vector>

namespace n91 {

	using i8 = std::int_least8_t;
	using i32 = std::int_least32_t;
	using i64 = std::int_least64_t;
	using u8 = std::uint_least8_t;
	using u32 = std::uint_least32_t;
	using u64 = std::uint_least64_t;
	using isize = std::ptrdiff_t;
	using usize = std::size_t;

	class rep {
		const usize f, l;

	public:
		class itr {
			friend rep;
			usize i;
			constexpr itr(const usize x) noexcept : i(x) {}

		public:
			void operator++() noexcept { ++i; }
			constexpr usize operator*() const noexcept { return i; }
			constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
		};
		constexpr rep(const usize first, const usize last) noexcept
			: f(first), l(last) {}
		constexpr itr begin() const noexcept { return itr(f); }
		constexpr itr end() const noexcept { return itr(l); }
	};
	class revrep {
		const usize f, l;

	public:
		class itr {
			friend revrep;
			usize i;
			constexpr itr(usize x) noexcept : i(x) {}

		public:
			void operator++() noexcept { --i; }
			constexpr usize operator*() const noexcept { return i; }
			constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
		};
		constexpr revrep(usize first, usize last) noexcept : f(--first), l(--last) {}
		constexpr itr begin() const noexcept { return itr(l); }
		constexpr itr end() const noexcept { return itr(f); }
	};
	template <class T> using vec_alias = std::vector<T>;
	template <class T> auto md_vec(const usize n, const T &value) {
		return std::vector<T>(n, value);
	}
	template <class... Args> auto md_vec(const usize n, Args... args) {
		return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
	}
	template <class T> constexpr T difference(const T &a, const T &b) {
		return a < b ? b - a : a - b;
	}

} // namespace n91

#include <algorithm>
#include <iostream>
#include <utility>

namespace n91 {

	void main_() {
		usize n;
		std::cin >> n;
		usize sum = n % 2 ? n : n + 1;
		std::cout << n*(n - 1) / 2 - n / 2 << std::endl;
		for (const auto i : rep(1, n+1)) {
			for (const auto j : rep(1, i)) {
				if (i + j != sum) {
					std::cout << i << " " << j << "\n";
				}
			}
		}
	}

} // namespace n91

int main() {
	n91::main_();
	return 0;
}


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

int main() {
    ll n, m;    cin >> n >> m;
    ll ans=0;
    if(n*2<=m){
        cout << (n*2+m)/4;
    }else{
        cout << m/2;
    }
    
    cout<< endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long int ll;
#define forn(i,p,n); for(long long i=p;i<n;++i)
#define pb push_back

void solve(){
	ll n;
	cin >> n;
	int a[100000][3];
	int dp[100000][3];
	forn(i,0,n){
		forn(j,0,3){
			cin >> a[i][j];
		}
	}
	forn(i,0,3){
		dp[0][i] = a[0][i];
	}	
	forn(i,1,n){
		forn(j,0,3){
			int maxE = INT_MIN;
			forn(k,0,3){
				if(k!=j)
				maxE = max(maxE,dp[i-1][k]);
			} 
			dp[i][j] = maxE+a[i][j];
		}
	}
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
	return ;
}

int main()
{
	fast;
	// int test;
	// cin >> test;
	// while(test--){
		solve();
	// 	cout<<"\n";
	// }
}

Measured memory_bytes: 5924
//
//  main.cpp
//  atcoder CODE FESTIVAL 2017 qual B problem B
//
//  Created by luras on 2017/10/8.
//  Copyright © 2017年 luras. All rights reserved.
//

#define ms(x, y) memset(x, y, sizeof(x))
#define mc(x, y) memcpy(x, y, sizeof(x))
#define lson o << 1, l, mid
#define rson o << 1 | 1, mid + 1, r
#define ls o << 1
#define rs o << 1 | 1
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<queue>
#include<map>
#include<stack>
#include<vector>
#include<list>
#include<set>
#include<string>
#include<algorithm>
#pragma comment(linker,"/STACK:102400000,102400000")
template <class T> inline void gmax(T &a, T b){if(b > a) a = b;}
template <class T> inline void gmin(T &a, T b){if(b < a) a = b;}
using namespace std;
const int N = 1e5 + 10, M = 2e6 + 10, Z = 1e9 + 7, maxint = 2147483647, ms1 = 16843009, ms31 = 522133279, ms63 = 1061109567, ms127 = 2139062143;
const double PI = acos(-1.0), eps = 1e-8;
typedef long long LL;
void fre()
{
    freopen("/Users/luras/Desktop/in.txt", "r", stdin);
    freopen("/Users/luras/Desktop/out.txt", "w", stdout);
}
const int INF = 1e9;
int casenum, casei;

int n, m;
map<int, int> mop;
int x;

int main()
{
    while(~ scanf("%d", &n)){
        for(int i = 1; i <= n; i ++) scanf("%d", &x), mop[x] ++;
        scanf("%d", &m);
        int flag = 1;
        for(int i = 1; i <= m; i ++){
            scanf("%d", &x);
            if(mop[x] == 0) flag = 0;
            else mop[x] --;
        }
        if(flag) puts("YES"); else puts("NO");
    }
    return 0;
}

/*
 
 
 题意:
 
 类型:
 
 分析:
 
 优化:
 
 trick:
 
 数据:
 
 Sample Input
 
 Sample Output
 
 
 */






Measured memory_bytes: 9600