akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#define _USE_MATH_DEFINES
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
double mysqrt(double x) {
	double l = 0, r = x;
	for (int i = 0; i < 64; ++i) {
		double m = (l + r) / 2.0;
		if (m*m < x)l = m;
		else r = m;
	}
	return l;
}
///////////////////////////////////////

int main() {
	int n, l; cin >> n >> l;
	int a[210];
	int sum = 0;
	for (int i = 1; i <= n; ++i) {
		a[i] = l + i - 1;
		sum += a[i];
	}
	int dif = INF;
	int key;
	for (int i = 1; i <= n; ++i) {
		int d = abs(a[i]);
		if (d < dif) {
			dif = d;
			key = i;
		}
	}
	int ans = sum - a[key];
	cout << ans << endl;
	return 0;
}

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

num = 3505

for i in range(1, num):
    if 4 / N > 1 / i:
        for j in range(1, num):
            if 4 / N > 1 / i + 1 / j:
                w = (N * i * j) / (4 * i * j - i * N - j * N)
                if w.is_integer():
                    print(i, j, int(w))
                    exit()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N; cin >> N;
  string P = "", Q = ""; vector<int> num(N);
  for(int i = 0; i < N; i++) {
    num.at(i) = i + 1;
    char c; cin >> c;
    P += c;
  }
  for(int i = 0; i < N; i++) {
    char c; cin >> c;
    Q += c;
  }
  vector<string> nums(0);
  sort(num.begin(), num.end());
  do {
    string S = "";
    for(int i = 0; i < N; i++) {
      S += to_string(num.at(i));
    }
    nums.push_back(S);
  } while(next_permutation(num.begin(), num.end()));
  sort(nums.begin(), nums.end());
  int p, q;
  for(int i = 0; i < nums.size(); i++) {
    if(nums.at(i) == P) p = i;
    if(nums.at(i) == Q) q = i;
  }
  cout << abs(p - q) << endl;
}

Measured memory_bytes: 2424
N = int(input())
dic = {}
for i in range(1,N+1):
    key = input()
    if key not in dic:
        dic[key] = 1
    else:
        dic[key] += 1
lis = []
for key,val in dic.items():
    lis.append([val,key])
lis.sort(reverse = True)

lis2 = []
fnum = lis[0][0]

for j in range(0,len(lis)): 
    if lis[j][0] == fnum:
        lis2.append(lis[j][1])
    else:
        break
lis2.sort()
for k in lis2:
    print(k)
    

Measured memory_bytes: 52188
use proconio::*;

// https://atcoder.jp/contests/tokiomarine2020/submissions/14270733
// ほぼこちらの写経

const MAX: usize = 1 << 18;
const MID: usize = 12;

fn chmax<T: Ord>(x: &mut T, a: T) {
    if *x < a {
        *x = a;
    }
}

fn merge<T: Ord + Copy>(mut a: Vec<T>, mut b: Vec<T>) -> Vec<T> {
    let mut c = Vec::with_capacity(a.len() + b.len());
    while !a.is_empty() && !b.is_empty() {
        if *a.last().unwrap() >= *b.last().unwrap() {
            c.push(a.pop().unwrap());
        } else {
            c.push(b.pop().unwrap());
        }
    }
    for a in a.into_iter().chain(b.into_iter()).rev() {
        c.push(a);
    }
    c.reverse();
    c
}

#[fastout]
fn run() {
    input! {
        n: usize,
        mut item: [(i32, i32); n],
        q: usize,
        ask: [(usize, i32); q],
    }
    while item.len() < MAX {
        item.push((0, 0));
    }
    item.insert(0, (0, 0));
    let mut query = vec![Some(vec![]); MAX + 1];
    for (i, &(v, w)) in ask.iter().enumerate() {
        query[v].as_mut().unwrap().push((w, 0, i));
    }
    for q in query.iter_mut() {
        q.as_mut().unwrap().sort();
    }
    let mut ans = vec![0; q];
    let mut stack = vec![(1, vec![(0, 0)])];
    while let Some((k, dp)) = stack.pop() {
        let (v, w) = item[k];
        let dp2 = dp.iter().map(|p| (p.0 + w, p.1 + v)).collect::<Vec<_>>();
        let dp = merge(dp, dp2);
        if 2 * k >= 1 << MID {
            let mut stack = vec![(2 * k, 0), (2 * k + 1, 0)];
            while let Some((k, op)) = stack.pop() {
                if op == 1 {
                    let (v, w) = item[k];
                    let a = query[k].take().unwrap();
                    let b = a.iter().map(|a| (a.0 - w, a.1 + v, a.2)).collect::<Vec<_>>();
                    let c = merge(a, b);
                    query[k / 2] = Some(merge(query[k / 2].take().unwrap(), c));
                } else {
                    stack.push((k, 1));
                    if 2 * k < MAX {
                        stack.push((2 * k, 0));
                        stack.push((2 * k + 1, 0));
                    }
                }
            }
        }
        let q = query[k].take().unwrap();
        let mut val = std::i32::MIN / 2;
        let mut p = 0;
        for (rem, v, k) in q.into_iter() {
            while p < dp.len() && dp[p].0 <= rem {
                val = std::cmp::max(val, dp[p].1);
                p += 1;
            }
            chmax(&mut ans[k], val + v);
        }
        if 2 * k < 1 << MID {
            stack.push((2 * k, dp.clone()));
            stack.push((2 * k + 1, dp));
        }
    }
    for a in ans {
        println!("{}", a);
    }
}

fn main() {
    run();
}


Measured memory_bytes: 19784
#include <cstdio>

int N,x,y,b,p;

int main(){
	scanf("%d",&N);
	for(int i = 0; i < N; i++){
		scanf("%d%d%d%d",&x,&y,&b,&p);
		int s = x*b+y*p;
		int s2 = (x*(b >= 5 ? b : 5) + y*(p >= 2 ? p : 2))*4/5;
		printf("%d\n",s > s2 ? s2 : s);
	}

	return 0;
}

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

int main(void){
  int A, B;
  cin >> A >> B;
  
  int ans = 0;
  
  
  for (int a = 1; a <= 9; a++) {
    for (int b = 0; b <= 9; b++) {
      for (int c = 0; c <= 9; c++) {
        if (A <= 10001 * a + 1010 * b + 100 * c && 10001 * a + 1010 * b + 100 * c <= B ) {
          ans++;
        }
        
      }
      
    }
    
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cassert>
using namespace std;
 
int calc(int);
long long cnt;
int X;
void insertionSort(int A[],int n,int g){
  int v,j;
  for(int i=g;i<n;i++){
    v=A[i];
    j=i-g;
    while(j>=0&&A[j]>v){
      A[j+g]=A[j];
      j=j-g;
      cnt++;
    }
    A[j+g]=v;
  }
}

int Gt[1000000],gt=0;
int  G[1000000], g=0;

void shellSort(int A[],int n){
 

  int Z =pow(n,1.5),flg,y;
  X=n;
  cnt=0;

  for(int i=n;i>=1;i--){
    if(n%i==0){
      Gt[gt++]=i;
      //cout<<i<<" - "<<endl;
    }else{
      if(i*i<=n&&n<=(i+1)*(i+1))Gt[gt++]=y=i;
    }
  }
  
  for(int i=0;i<gt;i++){
    if(i%2==1||i==y){
   
      G[g++]=Gt[i];
    }
  }
  G[g++]=1;
  
  int ng;
  while(1){
    if(g<100)break;
    ng=0;
    for(int i=0;i<g;i++){
      if(i==y||i%2==1){
	G[ng++]=G[i];
      }
    }
    g=ng;
  }
  for(int i=0;i<g;i++){
    insertionSort(A, n,G[i]);
  }
  
  cout<<g<<endl;
  for(int i=0;i<g;i++){
    if(i)cout<<' ';
    cout<<G[i];
  }
  cout<<endl;
  cout<<cnt<<endl;
  
  assert(g<100);
  assert(cnt<Z);
  //cout<<cnt<<" cnt"<<endl;
  //cout<<Z<<" Z"<<endl;
  //cout<<(int)pow(n,1.5)<<endl;
}
 
 
int main(){
 
  int n;
  int A[1000000];
 
  cin>>n;
  for(int i=0;i<n;i++)cin>>A[i];
   
   
  shellSort(A,n);
 
  for(int i=0;i<n;i++){
    cout<<A[i]<<endl;
  }
 
  return 0;
}
 
int calc(int n){
  for(int i=sqrt(n);i>=0;i--){
    if(n%i==0)return n/i;
  }
}

Measured memory_bytes: 7120
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

#define MAX_H	(25)
#define MAX_W	(25)
#define MAX_HW	(MAX_H * MAX_W)

/* global variables */

int h, w, hw, d;
char mat[MAX_HW][MAX_HW], v[MAX_HW];

/* subroutines */

bool solve() {
  for (int i = 0; i < hw; i++) {
    if (mat[i][i] == 0) {
      for (int i0 = i + 1; i0 < hw; i0++) {
        if (mat[i0][i] != 0) {
	  for (int j = 0; j < hw; j++) {
	    int tmp = mat[i0][j]; mat[i0][j] = mat[i][j]; mat[i][j] = tmp;
	  }
          int tmp = v[i0]; v[i0] = v[i]; v[i] = tmp;
          break;
	}
      }
    }

    if (mat[i][i] != 0) {
      for (int i0 = i + 1; i0 < hw; i0++) {
        if (mat[i0][i] != 0) {
          mat[i0][i] = 0;
          for (int j = i + 1; j < hw; j++)
            mat[i0][j] = (mat[i0][j] + mat[i][j]) & 1;
          v[i0] = (v[i0] + v[i]) & 1;
	}
      }
    }
  }
  //p mat; p v

  for (int i = hw - 1; i >= 0; i--) {
    for (int j = i + 1; j < hw; j++)
      v[i] = (v[i] + mat[i][j] * v[j]) & 1;
    if (mat[i][i] == 0 && v[i] != 0) return false;
  }
  //p mat; p v
  
  return true;
}

/* main */

int main() {
  for (;;) {
    cin >> w >> h >> d;
    if ((w | h | d) == 0) break;
    //printf("w=%d,h=%d,d=%d\n", w, h, d);
    
    hw = h * w;

    for (int y = 0; y < h; y++) {
      for (int x = 0; x < w; x++) {
	int pos = y * w + x;
	int b;
	cin >> b;
	v[pos] = b;

	for (int j = 0; j < hw; j++) mat[pos][j] = 0;
	mat[pos][pos] = 1;
      
	for (int dy = -d; dy <= d; dy++) {
	  int ddx = d - abs(dy);
	  int dxs[] = {-ddx, ddx};
	  
	  for (int dxi = 0; dxi < 2; dxi++) {
	    int dx = dxs[dxi];
	    int x0 = x + dx;
	    int y0 = y + dy;
	    if (x0 >= 0 && x0 < w && y0 >= 0 && y0 < h) {
	      int pos0 = y0 * w + x0;
	      mat[pos][pos0] = 1;
	    }
	  }
	}
      }
    }
    //p v; p mat

    puts (solve() ? "1" : "0");
  }

  return 0;
}

Measured memory_bytes: 1496
N = int(input())
a = [0] * N
b = [0] * N
c = [0] * N

cost = [a,b,c]
dp = [[0] * N, [0] * N, [0] * N]

for i in range(N):
    a[i], b[i], c[i] = map(int,input().split())

dp[0][0] = cost[0][0]
dp[1][0] = cost[1][0]
dp[2][0] = cost[2][0]

for i in range(1, N):
    dp[0][i] = max(dp[1][i-1] + cost[0][i], dp[2][i-1] + cost[0][i])
    dp[1][i] = max(dp[0][i-1] + cost[1][i], dp[2][i-1] + cost[1][i])
    dp[2][i] = max(dp[0][i-1] + cost[2][i], dp[1][i-1] + cost[2][i])

print(max(dp[0][-1], dp[1][-1], dp[2][-1]))

Measured memory_bytes: 26828
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string.h>
#include<math.h>
#include<cstring>
using namespace std;


int main(){
	
	char ql[]={"qwertasdfgzxcvb"},qr[]={"yuiophjklnm"};
	while(1){
		int n,i,j,k,x=1,sum=0;
		char a[33];
		cin>>a;
		if(a[0]=='#')break;
		n=strlen(a);
		for(i=0;i<strlen(ql);i++){
			if(ql[i]==a[0]){x=0;break;}
		}
		for(i=1;i<n;i++){
			if(x==0){
				for(j=0;j<strlen(qr);j++){
					if(qr[j]==a[i]){
						sum++;x=1;break;
					}
				}
			}else{
				for(j=0;j<strlen(ql);j++){
					if(ql[j]==a[i]){
						sum++;x=0;break;
					}
				}
			}
		}
		cout<<sum<<endl;
	}
    return 0;
}

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


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

    cout<< (a+b>=c ? "Yes" : "No") <<endl;

    return 0;
}


Measured memory_bytes: 256
n =int(input())
s=[""]*n
t=[0]*n
for i in range(n):
    s[i],t[i] = input().split()
    t[i] = int(t[i])
r = [0] * (n+1)
for i in range(1,n+1):
  r[i] = r[i-1] + t[i-1]
x=input()
ind = s.index(x)
print(r[n] - r[ind+1])

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{
  public static void main(String args[]) throws IOException{
   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
   String[] surface =  br.readLine().split(" ");
   String ordern = br.readLine();
   int n = Integer.parseInt( ordern );


   Dise dice1 = new Dise();
   dice1.setSurface(surface);
   dice1.SetDice(1, 2 , 3);


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

	   String[] order = br.readLine().split(" ");
	   dice1.RegulateDice( Integer.parseInt( order[0] ) ,Integer.parseInt( order[1] ));
	   dice1.SetDice(1, 2 , 3);
   }

  }
}

class Dise{

	int[] surface = new int [6];
    int Top,Bottom,Right,Left,Front,Back;


	void setSurface(String[] SurfaceString){

		for(int i = 0; i < 6; i++){

			surface[i] = Integer.parseInt( SurfaceString[i] );

		}

	}

    void SetDice(int top, int front, int right){
	   Top  = top - 1;
       Front = front - 1;
       Right = right - 1;
       Bottom = 5- (top - 1);
       Back = 5- (front - 1);
       Left = 5- (right - 1);
    }//SetDice


    void RegulateDice( int setTop, int setFront  ){


    	if( surface[Left] == setTop )   {


    	    RollDice("E");

    	}else if( surface[Right] == setTop ){

    		RollDice("W");

    	}else if( surface[Front] == setTop ){

    		RollDice("N");

    	}else if( surface[Back] == setTop ){

    		RollDice("S");

    	}else if( surface[Bottom] == setTop ) {

    		RollDice("NN");

    	}else {



    	}

    	if( surface[Left] == setFront )   {

      	  RollDice("NES");

      	}else if( surface[Right] == setFront ){

      		RollDice("NWS");

      	}else if(surface[Back]== setFront){

      		RollDice("NEES");

      	}

    	System.out.println( surface[Right] );
    }

    void RollDice(String RollString){

    	String[] SurfaceString =  RollString.split("");
    	for(int i = 0; i < SurfaceString.length ; i++){

    		if( SurfaceString[i].equals("W") ){

    			Bottom = Left;
    			Left = Top;
    			Top = 5 - Bottom;
    			Right = 5 - Left;

    		}else if( SurfaceString[i].equals("S")){

    			Bottom = Front;
    			Front = Top;
    			Top = 5 - Bottom;
    			Back = 5 - Front;

    		}else if( SurfaceString[i].equals("E")){

    			Bottom = Right;
    			Right = Top;
    			Top = 5 - Bottom;
    			Left = 5 - Right;

    		}else{

    			Bottom = Back;
    			Back = Top;
    			Top = 5 - Bottom;
    			Front = 5 - Back;

    		}
    	}


    }//RollDice

}

Measured memory_bytes: 24272
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

ll modPow(ll a, ll n, ll mod)
{
    if(n == 1)return a;
    if(n % 2 == 1) return (a * modPow(a, n-1, mod)) % mod;
    ll t = modPow(a, n/2, mod);
    return (t * t) % mod;
}


int main()
{
    int n, p; cin >> n >> p;
    int cnt = 0;
    ll ans = 1;
    rep(i, n){
        int a; cin >> a;
        if(a % 2 == 0) cnt++;
    }
    for(int i = 0; i < n; i++) ans *= 2;
    if(cnt != n)ans /= 2;
    if(cnt == n && p == 1)ans = 0;
    cout << ans << endl;
    system("pause");
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<(n);i++)
#define MOD 1000000007
typedef long long ll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}
template <class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <class T> inline T LCM(T a,T b){return a*b/GCD(a,b);}


  
int main(){
  int n,a,b,c;
  cin >> n;
  cout << 3*n*n << endl;
}

Measured memory_bytes: 256
import math
 
def main():
    n = int(input())
    ans = 0
    for i in range(1,n+1):
        for j in range(1,n+1):
            tmp = math.gcd(i,j)
            for k in range(1,n+1):
                ans += math.gcd(tmp,k)
 
    print(ans)
 
if __name__ == "__main__":
    main()

Measured memory_bytes: 9192
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int N;
  string S;
  cin>>N>>S;
  reverse(S.begin()+N,S.end());
  map<pair<string,string>,int> A,B;
  for(int i=0;i<(1<<N);i++){
    bitset<18> C(i);
    string T="",U="";
    for(int j=0;j<N;j++){
      if(C.test(j))
        T+=S[j];
      else
        U+=S[j];
    }
    A[make_pair(T,U)]++;
  }
  for(int i=0;i<(1<<N);i++){
    bitset<18> C(i);
    string T="",U="";
    for(int j=0;j<N;j++){
      if(C.test(j))
        T+=S[j+N];
      else
        U+=S[j+N];
    }
    B[make_pair(T,U)]++;
  }
  int ans=0;
  for(pair<pair<string,string>,int> p:A){
    ans+=p.second*B[p.first];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 89480
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=4e3+11;
const int M=2e5+11;
const int mod=1e9+7;
const int bs=2e3+1;
int n,k,f[N][N],a[M],b[M];
int ans,fac[(N<<1)+11],ifac[(N<<1)+11];
int read(){
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-f;ch=getchar();}
    while(isdigit(ch)){x=x*10+ch-48;ch=getchar();}
    return x*f;
}
int qpow(int a,int b){
    int re=1;
    while(b){
        if(b&1) re=(re*a)%mod;
        b>>=1;a=a*a%mod;
    }return re;
}
int C(int a,int b){
    if(a<b) return 0;
    return fac[a]*ifac[b]%mod*ifac[a-b]%mod;
}
signed main(){
    n=read();
    for(int i=1;i<=n;i++)
        a[i]=read(),b[i]=read();
    fac[0]=1;ifac[0]=1;
    for(int i=1;i<=2*N;i++) fac[i]=fac[i-1]*i%mod;
    ifac[2*N]=qpow(fac[2*N],mod-2);
    for(int i=2*N-1;i;i--) ifac[i]=ifac[i+1]*(i+1)%mod;
    for(int i=1;i<=n;i++) ++f[bs-a[i]][bs-b[i]];
    for(int i=1;i<N;i++)
        for(int j=1;j<N;j++)
            f[i][j]=(f[i][j]+(f[i-1][j]+f[i][j-1])%mod)%mod;
    for(int i=1;i<=n;i++){
        ans=(ans+f[bs+a[i]][bs+b[i]])%mod;
        ans=(ans+mod-C(2*(a[i]+b[i]),a[i]+a[i]))%mod;
    }
    printf("%lld\n",ans*ifac[2]%mod);
    return 0;
}


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

int main() {
    // input
    ll A[3][3];
    for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < 3; ++j) {
            cin >> A[i][j];
        }
    }
    bool B[3][3];
    for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < 3; ++j) {
            B[i][j] = false;
        }
    }
    ll N; cin >> N;
    for (int i = 0; i < N; ++i) {
        ll b; cin >> b;
        for (int i = 0; i < 3; ++i) {
            for (int j = 0; j < 3; ++j) {
                if (b == A[i][j]) B[i][j] = true;
            }
        }
    }

    // check
    bool res = false;
    for (int i = 0; i < 3; ++i) {
        if (B[i][0] && B[i][1] && B[i][2]) {
            res = true;
        }
    }
    for (int j = 0; j < 3; ++j) {
        if (B[0][j] && B[1][j] && B[2][j]) {
            res = true;
        }
    }
    if(B[0][0] && B[1][1] && B[2][2] || B[0][2] && B[1][1] && B[2][0]) res = true;
    if(res) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  sort(S.begin(),S.end());
  if(S[0]!='a'){cout << 'a' << endl; return 0;}
  for(int i=0;i<S.size()-1;i++){
    if(S[i+1]-S[i]>=2){
      char ans=S[i]+1;
      cout << ans << endl;
      return 0;
    }
  }
  
  if(S[S.size()-1]!='z'){
    char ans=S[S.size()-1]+1;
    cout << ans << endl;}
  else{cout << "None" << endl;}
}

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

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

    vector<int> A(n);
    for(int i = 0; i < n; i++)  cin >> A[i];

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

    cout << A[n-1]-A[0] << endl;

    return 0;
}

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

using namespace std;

vector<vector<int>> adjl;
vector<int> dp;

void dfs(int u)
{
    int tmp = 0;
    for (int i = 0; i < adjl[u].size(); i++)
    {
        int v = adjl[u][i];
        if (dp[v] == -1)
            dfs(v);
        tmp = max(tmp, 1 + dp[v]);
    }
    dp[u] = tmp;
    return;
}
int main()
{
    int n, m;
    cin >> n >> m;
    adjl.resize(n);
    dp.assign(n, -1);
    int x, y;
    for (int i = 0; i < m; i++)
    {
        cin >> x >> y;
        x--;
        y--;
        adjl[x].push_back(y);
    }
    for (int i = 0; i < n; i++)
    {
        if (dp[i] == -1)
        {
            dfs(i);
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        ans = max(ans, dp[i]);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 8192
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int 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};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin >> n;
    int m=1;
    while(m*(m+1)/2<n){
        m++;
    }
    FOR(i,1,m+1){
        if(i==m*(m+1)/2-n){
            continue;
        }
        cout << i << endl;
    }
}

Measured memory_bytes: 3608
#include<stdio.h>

int main(void){

	int W,H,x,y,r;

	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

	if((x-r)<0 || (x+r)>W){
		printf("No\n");
	}
	else if((y-r)<0 || (y+r)>H){
		printf("No\n");
	}
	else{
		printf("Yes\n");
	}
}


Measured memory_bytes: 2084
import math

n, d = tuple([int(s) for s in input().split()])
x = [[0]*d for i in range(n)]

for i in range(n):
    x_t = [int(s) for s in input().split()]
    x[i] = x_t

cnt_fit = 0

for i in range(n-1):
    for j in range(i+1, n):
        sumd = 0
        for k in range(d):
            sumd += (x[i][k] - x[j][k]) ** 2
        sumd = math.sqrt(sumd)
        if sumd - int(sumd) == 0.0:
            cnt_fit += 1

print(cnt_fit)


Measured memory_bytes: 3064
def Switches():
    from math import log2
    N, M = map(int, input().split())
    # m行n列
    switchList = []

    # スイッチの組み合わせ取得
    for i in range(M):
        k = list(map(int, input().split()))
        k = k[1:]
        # print(k)
        switchList.append([True * (i+1 in k) for i in range(N)])
    p = list(map(int, input().split()))
    # print(switchList)
    result = 0

    # 2bit化し、条件比較を行い結果がpと等しければ正解とする
    for i in range(2**N):
        tmp = format(i, "0"+str(N)+"b")
        tmp = [int(j) for j in tmp]
        # print(tmp)
        tmp = [sum([switchList[k][j] * tmp[j] for j in range(N)]) % 2 for k in range(M)]
        if p == tmp:
            result += 1

    print(result)

if __name__ == "__main__":
    Switches()

Measured memory_bytes: 3064
function Main(s){
  s = s.split("\n");
  var n = +s[0];
  var m = 1 << n;
  var a = s[1].split(" ").map(a=>+a);
  var b = [a[0]], c = [[a[0],0]], d = [[-1,-1]];
  for(var i = 1; i < m; i++){
    f(i);
  }
  console.log(b.slice(1).join("\n"));
  
  function f(n){
    var q = {}, s = [[a[n],n],[-1,-1]];
    for(var i = 1; i <= n; i <<= 1){
      var u = n & (i ^ 0xFFFFF);
      if(u === n)continue;
      if(s[1][0] > c[u][0])continue;
      if(s[0][1] !== c[u][1] && s[1][1] !== c[u][1]){
        if(s[0][0] <= c[u][0]){s[1] = [s[0][0],s[0][1]]; s[0] = c[u];}
        else s[1] = c[u];
      }
      if(s[1][0] <= d[u][0] && s[0][1] !== d[u][1] && s[1][1] !== d[u][1]){
        if(s[0][0] > d[u][0])s[1] = d[u];
        else {s[1] = [s[0][0],s[0][1]]; s[0] = d[u];}
      }
    }
    c[n] = s[0];
    d[n] = s[1];
    b[n] = Math.max(b[n-1], c[n][0] + d[n][0]);
  }
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 122340
#pragma GCC optimize("O3")
            #pragma comment(linker, "/stack:200000000")
            #pragma GCC optimize("unroll-loops")
             
            #include <algorithm>
            #include <bitset>
            #include <cassert>
            #include <chrono>
            #include <cmath>
            #include <complex>
            #include <cstdio>
            #include <cstdlib>
            #include <cstring>
            #include <ctime>
            #include <deque>
            #include <functional>
            #include <iomanip>
            #include <iostream>
            #include <iterator>
            #include <limits>
            #include <climits>
            #include <list>
            #include <map>
            #include <numeric>
            #include <queue>
            #include <random>
            #include <ratio>
            #include <set>
            #include <sstream>
            #include <stack>
            #include <string>
            #include <unordered_map>
            #include <unordered_set>
            #include <utility>
            #include <vector>
            using namespace std;
             
            typedef long long ll;
            typedef long double ld;
            #define int ll
            #define double ld
            #define pb push_back
            #define mp make_pair
            #define REP(i,n) for (int i = 0; i < n; i++)
            #define loop(i,n) for (int i = 0; i < n; i++)
            #define FOR(i,a,b) for (int i = a; i < b; i++)
            #define REPD(i,n) for (int i = n-1; i >= 0; i--)
            #define FORD(i,a,b) for (int i = a; i >= b; i--)
            #define remax(a,b) a = max(a,b)
            #define remin(a,b) a = min(a,b)
            #define mem(a, b) memset(a, b, sizeof a)
            #define append push_back
            #define all(v) v.begin(),v.end()
            #define F first
            #define S second
            #define print(x) cout << (x) << endl
            #define PRECISION(x) cout << fixed << setprecision(x)
            #define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
            #define N 300005
            const double PI=acos(-1);
            const int MOD = 1000000007;
            const int FMOD = 998244353;
            const double eps = 1e-9;
             
            mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
            
            signed main()
            {
            
	int n,k;
	cin >> n >> k;
	vector<int> v(n);
	loop(i,n){
		cin >> v[i];
		v[i]--;
	}
	map<int,int> mp1;
	mp1[0] = 1;
	vector<int>  res;
	res.pb(0);
	int st = 0,cyc = -1;
	while(1){
		int p = v[st];
		if(mp1[p]){
			cyc = p;
			break;
		}
		res.pb(p);
		st = p; 
		mp1[st] = 1;
	}
	if(res.size() > k){
	
		cout << res[k]+1 << endl;
	}
	else{
		vector<int> v1;
		bool ok = 0;
		for(int i=0;i<res.size();i++){
			if(res[i] == cyc){
				v1.pb(res[i]);
				ok = 1;
			}
			else if(ok){
				v1.pb(res[i]);
			}
		}
		k -= res.size();
		cout << v1[k%v1.size()]+1 << endl;
	}
    return 0;
				
			}

Measured memory_bytes: 19108
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
ll roundd(ll x,ll n){
  if(x>n){return x%n;}
  else if(x<0){return x%n+n;}
  else return x;
}
bool isprime(ll n){
    if(n==1)return false;
    for (ll i = 2; i * i <= n; i++) {
        if(n%i==0)return false;
    }
    return true;
}

ll modpow(ll x, ll n){
	ll r=1;
	while(n){
		if(n&1) r=r*x%MOD;
		x=x*x%MOD;
		n>>=1;
	}
	return r;
}
int main(){
  ll n;cin>>n;
  vll a(n);vvll cnt(60,vll(2,0));
  rep(i,0,n){
    cin>>a[i];
  }
  rep(i,0,n){
    rep(j,0,60){
      if(a[i]>>j&1)cnt[j][1]++;
      else cnt[j][0]++;
    }
  }
  ll ans=0;
  rep(i,0,60){
    cnt[i][0]%=MOD;cnt[i][1]%=MOD;
    ans+=(modpow(2,i)*((cnt[i][0]*cnt[i][1])%MOD))%MOD;
    ans%=MOD;
  }
  cout<<ans<<endl;
}



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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
#define print(x) cout<<'>'<<#x<<':'<<x<<endl;
#define F first
#define S second
const int mod=1000000007;

void solve(){
    int a,b,c;
    cin>>a>>b>>c;
    int x;cin>>x;
    int ans=0;
    for (int i=0;i<=a;i++){
        for (int j=0;j<=b;j++){
            for (int k=0;k<=c;k++){
                if ((500*i+100*j+50*k)==x){
                    ans++;
                }
            }
        }
    }cout<<ans<<endl;
}

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

    return 0;
}




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

using namespace std;

#define ll long long
#define ld long double
#define ff first
#define ss second
#define rsz resize
#define ins insert 
#define mp make_pair
#define pf push_front 
#define pb push_back
#define eb emplace_back 
#define ft front() 
#define bk back()
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define deb(x) cout<<#x<<" "<<x<<'\n';
#define rep(i,a,b) for (int i = (a); i < (b); ++i)

const ll mod = 1e9+7; // 998244353;
const ll inf = 1e18; 
const ld pie = acos((ld)-1);

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



int main(){
    
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	int arr[3];arr[0]=a;arr[1]=b;arr[2]=c;
	int ans=0;
	sort(arr,arr+3);
	printf("%d\n",arr[2]-arr[1] + arr[1]-arr[0]);


	return 0;

	/*STUFF TO LOOK:	
		1. Check the constraints
		2. Corner cases(n==0||n==1)
		3. Variables in loops
		4. Make sure two ints aren’t multiplied to get a long long
		5. Don't use scanf or printf while using ios_base
		6. using the local variable of the same name when global variable was required to be used
	*/
}


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

int main(){ 
    int n,k;
    string s;
    cin >> n >> k >> s;
        if(s.at(k-1)=='A'){
            s.at(k-1)='a';
        }
    else if(s.at(k-1)=='B'){
            s.at(k-1)='b';
        }else if(s.at(k-1)=='C'){
            s.at(k-1)='c';
        }
        cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}


int main() {
  ll x, y, z, K; cin >> x >> y >> z >> K;
  Vll a(x), b(y), c(z);
  rep(i, x) cin >> a[i];
  rep(i, y) cin >> b[i];
  rep(i, z) cin >> c[i];
  sort(all(a), greater<ll>());
  sort(all(b), greater<ll>());
  sort(all(c), greater<ll>());

  priority_queue<tuple<ll, int, int, int>> pq;
  pq.push(make_tuple(a[0]+b[0]+c[0], 0, 0, 0));

  set<int> done;
  done.insert(0);

  rep(_, K) {
    ll f; int i, j, k;
    tie(f, i, j, k) = pq.top(); pq.pop();
    cout << f << endl;

    int next;

    next = (i+1)*y*z + j*z + k;
    if (done.count(next) == 0 && i+1 < x) {
      pq.push(make_tuple(a[i+1]+b[j]+c[k], i+1, j, k));
      done.insert(next);
    }
    next = i*y*z + (j+1)*z + k;
    if (done.count(next) == 0 && j+1 < y) {
      pq.push(make_tuple(a[i]+b[j+1]+c[k], i, j+1, k));
      done.insert(next);
    }
    next = i*y*z + j*z + k+1;
    if (done.count(next) == 0 && k+1 < z) {
      pq.push(make_tuple(a[i]+b[j]+c[k+1], i, j, k+1));
      done.insert(next);
    }
  }
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef vector<ll> vi;

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

	string S;
	cin >> S;
	for(int i = 0; i < 3; ++i) cout << S[i];
	cout << "\n";

	return 0;
}

Measured memory_bytes: 3640
c = input()
list = ['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']

if c in list:
    print(list[list.index(c) + 1])

Measured memory_bytes: 38384
from collections import defaultdict
n = int(input())
s_dict = defaultdict(int)
for _ in range(n):
    s_dict[input()] += 1
count_max = sorted(s_dict.values())[-1]
s_list = sorted([s for s, count in s_dict.items() if count == count_max])
for s in s_list:
    print(s)

Measured memory_bytes: 33364
(defun split (x str)
  (let ((pos (search x str))
        (size (length x)))
    (if pos
      (cons (subseq str 0 pos)
            (split x (subseq str (+ pos size))))
      (list str))))

(defparameter N (parse-integer (read-line)))
(defparameter lst
  (loop repeat N collect (split " " (read-line))))
(defparameter X (read-line))

(defun calc (lst x)
  (if (null lst)
      0
      (if (equal (caar lst) x)
          (apply #'+ (mapcar #'(lambda (x) (parse-integer (cadr x))) 
                             (cdr lst)))
          (calc (cdr lst) x))))

(format t "~A" (calc lst X))


Measured memory_bytes: 15720
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://agc002.contest.atcoder.jp/tasks/agc002_b>
問題文============================================================
 N 個の箱があります。 箱は 1 から N まで番号が振られています。
 最初、1 番目の箱には赤いボールが 1 個入っています。
 また、2～N 番目の箱には白いボールが 1 個ずつ入っています。
 
 高橋君は M 回の操作を順に行います。
 i 回目の操作では、xi 番目の箱から適当なボールを 1 個選び、それを yi 番目の箱へ移します。
 
 高橋君がすべての操作を終えた後、赤いボールが入っている可能性のある箱は何個か求めてください。
=================================================================

解説=============================================================

================================================================
*/
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll N,M; cin >> N >> M;
    vector<pll> B(N,pll(1,0));
    B[0].second = 1;
    for(int i = 0; i < M;i++){
        ll x,y; cin >> x >> y;
        x--; y--;
        if(B[x].second == 1){
            B[y].second = 1;
        }
        B[y].first++;
        B[x].first--;
        if(B[x].first == 0) B[x].second = 0;
    }
    ll ans = 0;
    for(int i = 0; i < N;i++) ans += B[i].second;
    cout << ans << endl;
	return 0;
}


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

int main()
{
    int N;
    cin >> N;
    
    for (int y = 1; y < 10; ++y)
    {
        for (int x = 1; x < 10; ++x)
        {
            if ((y * x) == N)
            {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    
    cout << "No" << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

class Unionfind:

    __slots__ = ['nodes','size']

    def __init__(self, n):
        self.nodes = list(range(n))
        self.size = [1]*n

    def root(self, x):
        if self.nodes[x] == x:
            return x
        else:
            root_x = self.root(self.nodes[x])
            self.nodes[x] = root_x
            return root_x

    def unite(self, x, y):
        x = self.root(x); y = self.root(y)
        if x == y:
            return
        if self.size[x] < self.size[y]:
            x, y = y, x
        self.size[x] += self.size[y]
        self.nodes[y] = x

    def same(self, x, y):
        return self.root(x) == self.root(y)

N,M = map(int,input().split())
info = [list(map(int,input().split())) for _ in range(M)]

uf = Unionfind(N)

for x,y,z in info:
    x -= 1
    y -= 1
    uf.unite(x,y)

for i in range(N):
    uf.root(i)

ans = len(list(set(uf.nodes)))
print(ans)

Measured memory_bytes: 38332
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>

#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
#define rep_r(i,s,n)for(int i = n;i>s;i--)
#define rep_re(i,s,n)for(int i = n;i>=s;i--)
using namespace std;
typedef long long ll;
static const ll MOD = 1e9 + 7;
static const ll INF = 1e25;
static const ll MAX_N = 100001;

//n番目　一つ前、二つ前、三つ前
ll dp[101][4][4][4];
void add(ll& a, ll b) {
	a = (a + b) % MOD;
}
// a, b, cが "AGC" だったらtrue
bool ng(int a, int b, int c) {
	return (a == 1 && b == 2 && c == 3);
}

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

	dp[0][0][0][0] = 1;
	rep(i, 0, N) {
		rep(a, 0, 4) rep(b, 0, 4) rep(c, 0, 4) rep(d, 0, 4) {
			// 3文字NGパターン AGC, GAC, ACG
			if (ng(b, c, d) || ng(c, b, d) || ng(b, d, c)) continue;
			// 4文字NGパターン AXGC, AGXC
			if (ng(a, c, d) || ng(a, b, d)) continue;

			dp[i + 1][b][c][d] = (dp[i + 1][b][c][d] + dp[i][a][b][c]) % MOD;
		}
	}

	ll ans = 0;
	rep(j, 0, 4) rep(k, 0, 4) rep(l, 0, 4) {
		ans = (ans + dp[N][j][k][l]) % MOD;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <iomanip>
#include <cmath>
#include <algorithm>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
template<class T> inline void chmin(T& a, T b) {if (a>b) a=b; }
template<class T> inline void chmax(T& a, T b) {if (a<b) a=b; }
inline void print() { cout << endl; }
template <class Head, class... Tail> inline void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " "; print(forward<Tail>(tail)...);}
template <class T> inline void print(vector<T>& vec) { for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " "; } cout << endl;}
template <class T> inline void print(vector<vector<T>>& df) { for (auto& vec : df) { print(vec); }}
typedef long long ll;
const ll LINF = 1e18;
const int INF = 1e9;


int main() { 
    int N, K; cin >> N >> K;
    ll ct = 0;

    vector<ll> num(K, 0);
    for(int i=1; i<=N; i++) {
        num[i%K]++;
    }
    REP(a, K) {
        int b = (K-a) % K;
        int c = (K-a) % K;
        if((b+c)%K != 0) continue;
        ct += num[a] * num[b] * num[c];
    }

    print(ct);

    
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP2(i, x, n) for (int i = x; i < (n); i++)
#define ALL(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    long long int a, b, k;
    cin >> a >> b >> k;

    if (a - k < 0)
    {
        if (b - (k - a) < 0)
            cout << 0 << " " << 0 << endl;
        else
            cout << 0 << " " << b - (k - a) << endl;
    }
    else
    {
        cout << a - k << " " << b << endl;
    }
#if 0
    for(long long int i = 0; i < k; i++){
        if (a == 0 && b == 0) break;
        if (a != 0) a--;
        else b--;
    }
    cout << a << " " << b << endl;
#endif
    return 0;
}

Measured memory_bytes: 256
object Main{
	def main(args: Array[String]):Unit={
		loop()
	}
	def compale():String={
		val input = io.StdIn.readLine split " "
		val (a,b) = (input(0).toInt,input(1).toInt)
		if(a < b)
			return a.toString+" "+b.toString
		else if( a==0 && b==0 )
			return "quit"
		else
			return b.toString+" "+a.toString
	}
	def loop():Unit={
		val result=compale
		if(result!="quit"){
			println(result)
			loop()
		}
	}
}

Measured memory_bytes: 45788
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
const int MAXN = 2e5 + 5;

int a[MAXN],t[MAXN];

int main(void)
{
	int n;
	scanf("%d",&n);
	for(int i=1; i<=n; ++i) scanf("%d",&a[i]);
	
	for(int i=1; i<=n; ++i) ++t[a[i]];
	
	ll ans=0;
	for(int i=1; i<=n; ++i)
		ans += (ll)t[i]*(t[i]-1)/2;
	for(int i=1; i<=n; ++i)
		printf("%lld\n",ans-(t[a[i]]-1));
	return 0;
}

Measured memory_bytes: 3584
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
cnt = 0
for _ in range(N):
    A = list(map(int, input().split()))
    s = C
    for i in range(M):
        s += A[i] * B[i]
    if s > 0:
        cnt += 1
print(cnt)


Measured memory_bytes: 3060
n = int(input())
a = list(map(int, input().split()))

import math
two = 0
four = 0
for i in range(n):
    if a[i]%2 == 0:
        two += 1
        if a[i]%4 == 0:
            four += 1
two = two - four
count = four + two/2

if count >= math.ceil((n-1)/2):
    print('Yes')
else:
    print('No')

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

int main() {
  int n;
  cin >> n;
  vector<vector<int>> g(n, vector<int>(3));
  vector<int> a(101), b(101), c(101);
  for (int i = 0; i < n; i ++) {
    for (int j = 0; j < 3; j ++) {
      cin >> g[i][j];
      if (j == 0) a[g[i][j]] ++;
      else if (j == 1) b[g[i][j]] ++;
      else if (j == 2) c[g[i][j]] ++;
    }
  }

  vector<int> score(n);
  for (int i = 0; i < n; i ++) {
    if (a[g[i][0]] == 1) score[i] += g[i][0];
    if (b[g[i][1]] == 1) score[i] += g[i][1];
    if (c[g[i][2]] == 1) score[i] += g[i][2];
  }

  for (int i = 0; i < n; i ++) {
    cout << score[i] << endl;
  }
}


Measured memory_bytes: 3172
#解説放送見てからの書き直し
import sys
import os
INF = 10**12
ans = INF
N, M = map(int,input().split())
A = [0 for _ in range(M)]
B = [0 for _ in range(M)]
C = []
for i in range(M):
    a, b = map(int,input().split())
    A[i] = a  #鍵の金額
    B[i] = b  #開けられる宝箱の種類数
    tmp = list((map(int,input().split())))
    s = 0
    for j in range(b):
        t = tmp.pop(0)-1
        s |= 1 << t
    C.append(s)
dp = [INF]*(1<<N) #2^N
dp[0] = 0
for s in range(1<<N):
    for j in range(M):
        t = s | C[j]
        cost = dp[s] + A[j]
        dp[t] = min(dp[t],cost)
ans = dp[-1]
if ans == INF:
    ans = -1
print(ans)


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

using namespace std;

bool bubbleSort(vector<pair<char,int>>& A, int N) // N 個の要素を含む 0-オリジンの配列 A
{
    bool flag = true; // 逆の隣接要素が存在する
    while(flag){
	flag = false;
	for(int j = N-1; j >= 1; j--){ // j が N-1 から 1 まで
	    if(A.at(j).second < A.at(j-1).second){
		// A[j] と A[j-1] を交換
		swap(A.at(j), A.at(j-1));
		flag = true;
	    }
	}
    }
    return true;
}

bool selectionSort(vector<pair<char,int>>& A, int N) // N個の要素を含む0-オリジンの配列A
{
    for(int i = 0; i < N; i++){
	int minj = i;
	for(int j = i; j < N; j++){
	    if(A.at(j).second < A.at(minj).second){
		minj = j;
	    }
	}
	swap(A.at(i), A.at(minj));
    }
    return true;
}

bool is_stable(vector<pair<pair<char,int>,int>>& O, vector<pair<char,int>>& A){
    for(int i = 0; i < A.size(); i++){
	int o0 = 0, o1 = 0;
	for(int j = i+1; j < A.size(); j++){
	    if(A.at(i).second == A.at(j).second){
		int a, b;
		for(int k = 0; k < O.size(); k++){
		    if(O.at(k).first.first == A.at(i).first && O.at(k).first.second == A.at(i).second){
			a = O.at(k).second;
			break;
		    }
		}
		for(int k = 0; k < O.size(); k++){
		    if(O.at(k).first.first == A.at(j).first && O.at(k).first.second == A.at(j).second){
			b = O.at(k).second;
			break;
		    }
		}
		if(a > b) return false;
	    }
	}
    }
    return true;
}


int main()
{
    int N;
    cin >> N;
    vector<pair<pair<char,int>,int>> O(N, pair<pair<char,int>,int>(pair<char,int>(0,0),0));
    vector<pair<char,int>> A(N, pair<char,int>(0,0));
    vector<pair<char,int>> B(N, pair<char,int>(0,0));
    for(int i = 0; i < N; i++){
	cin >> A.at(i).first >> A.at(i).second;
	B.at(i).first = A.at(i).first;
	B.at(i).second = A.at(i).second;
	O.at(i).first.first = A.at(i).first;
	O.at(i).first.second = A.at(i).second;
	O.at(i).second = i;
    }
    bubbleSort(A, N);
    selectionSort(B, N);
    
    string sep;
    sep = "";
    for(pair<int,int> a: A){
	cout << sep << (char)a.first << a.second;
	sep = " ";
    }
    cout << endl;
    if(is_stable(O, A)){
	cout << "Stable" << endl;
    }else{
	cout << "Not stable" << endl;
    }
    sep = "";
    for(pair<int,int> b: B){
	cout << sep << (char)b.first << b.second;
	sep = " ";
    }
    cout << endl;
    if(is_stable(O, B)){
	cout << "Stable" << endl;
    }else{
	cout << "Not stable" << endl;
    }
}



Measured memory_bytes: 3140
#include <stdio.h>

int main(void)
{
    int n, m;
    scanf("%d", &n);
    scanf("%d", &m);
    int a[10000];
    int sum=0;
    for(int i=0; i<m; i++){
        scanf("%d", &a[i]);
        sum += a[i];
    }

    if(n<sum){
        printf("%d", -1);
    }else{
        printf("%d", n-sum);
    }

}

Measured memory_bytes: 1764
<?php
list($s) = strs();
$sum = 0;
for ($i = 0; $i < strlen($s); ++$i) {
    $sum += $s[$i];
}
echo $sum % 9 ? 'No' : 'Yes';
function strs()
{
    return explode(' ', trim(fgets(STDIN)));
}


Measured memory_bytes: 16404
#include<iostream>
#include<cstdlib>
#include<utility>
#include<tuple>
#include<string>
#include<vector>
#include<numeric>
#include<algorithm>
#include<queue>
#include<deque>
#include<bitset>
#include<cmath>
#include<map>
#include<iomanip>
using namespace std;
using ll = long long int;
const ll mod = 1e9 + 7;
#define rep(i, a, b) for(ll i = a; i <= b; i++)

int main() {

	ll n;
	cin >> n;

	if (n % 2 != 0) n++;

	cout << n / 2 << endl;

	return 0;
}

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

#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);

#define ll long long
#define ld long double
#define ull unsigned long long
#define ut uint64_t

#define pb push_back
#define ins insert
#define er erase

#define fi(i, b) for (int i=0;i<b;i++)
#define fll(i, b) for (ll i=0;i<b;i++)
#define fla(i,a,b) for (ll i=a;i<b;i++)

#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vb vector<bool>
#define vst vector<string>
#define vpii vector<pii>
#define vpll vector<pll>
#define vv(n,m) vector<vector<ll> > vec( n , vector<ll> (m, 0))


#define all(v) v.begin(), v.end()
#define lb lower_bound
#define ub upper_bound
#define mxe max_element
#define mne min_element

#define srt(v) sort(all(v))
#define rsrt(v) sort(v.rbegin(), v.rend())

#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second

#define mii map<int, int>
#define mll map<ll, ll>
#define umii unordered_map<int, int>
#define umll unordered_map<ll, ll>

#define si set<int>
#define sll set<ll>
#define usi unordered_set<int>
#define usll unordered_set<ll>
#define spii set<pii>
#define spll set<pll>

#define pqi priority_queue<int>
#define pqll priority_queue<ll>

 #define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*1ll * (b)) / gcd(a, b)

#define nl "\n"
using namespace std;


ll md = 1000000007;
ll ma = 998244353;

ll pw(ll a, ll b)
{
    ll c = 1, m = a;
    while (b){
        if (b & 1)c = (c * m);
        m = (m * m);
        b /= 2;
    }
    return c;
}

ll pwmd(ll a, ll b){
    ll c = 1, m = a;
    while (b){
        if (b & 1)
            c = ((c * m)) % md;
        m = (m * m) % md;
        b /= 2;
    }
    return c;
}


ll modinv(ll n)
{
    return pwmd(n, md - 2);
}
ll min(ll a,ll b){
    if(a>=b)return b;
    return a;
    
//vst vect={'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'};
    
    
    
}
void solve(){
    ll n;
    cin>>n;
    if(n>81){cout<<"No";return;}
    else {
        for(int i=1;i*i<=n;i++){
            if(n%i==0){
                if(i<=9&&n/i<10){cout<<"Yes";return;}
            }
        }
        cout<<"No";
    }
    
}

// AB DEKHO JAADU...

int main(){

    fast;
    ll tests=1;
    //cin>>tests;
    while(tests--){
        solve();
    }

    return 0;
    }

// KHATAM HO GAYA:)...






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

#define pb push_back
#define ff first
#define ss second
#define SIZE 2001
#define INF 2e9 + 9
#define acmpIN "input.txt"
#define acmpOUT "output.txt"
#define usacoIN "buckets.in"
#define usacoOUT "buckets.out"

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;


ll n, a, b;


int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
//    freopen(acmpIN, "r", stdin);
//    freopen(acmpOUT, "w", stdout);

    cin >> n >> a >> b;
    ll all = a + b;
    ll kol = n / all;
    ll ans = 0;
    ans += kol * a;
    kol = n % all;
    ans += min(kol, a);
    cout << ans;

    return 0;
}


Measured memory_bytes: 256