akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(){
    int h,w;
    scanf("%d %d",&h,&w);
    int tile[100][100];
    int i,j;
    int count = 0;

    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            tile[i][j]=0;
        }
    }
    for(i=0;i<h;i++){
        printf("\n");
        for(j=0;j<w;j++){
    //        printf("%d",tile[i][j]);
        }
    }


    int a,b;
    scanf("%d %d",&a,&b);
    //scanf("%d %d",&tmp1,&tmp2);
    for(i=0;i<a;i++){
        for(j=0;j<w;j++){
            tile[i][j]=1;
        }
    }
    for(i=0;i<h;i++){
        for(j=0;j<b;j++){
            tile[i][j]=1;
        }
    }
    //count
    for(i=0;i<h;i++){
        printf("\n");
        for(j=0;j<w;j++){
         //   printf("%d",tile[i][j]);
        }
    }

    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            if(tile[i][j]==0) count++;
        }
    }
    printf("%d\n",count);
    return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

namespace AtCorder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            Console.WriteLine(180*(n-2));
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MAX 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define zoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main() {


    zoom;
    ll M1, D1, M2, D2;
    cin >> M1 >> D1 >> M2 >> D2;
    if(M1 == 2 && D1 == 28) {
    	cout << 1;
    	return 0;
    }
    if((M1 == 9 || M1 == 4 || M1 == 6 || M1 == 11) && D1 == 30) {
    	cout << 1;
    	return 0;
    }
    if(D1 == 31)
    	cout << 1;
    else
    	cout << 0;
    return 0;
}

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

using namespace std;

int main(){
	double x, h, teimen, sokumen, sh, shpm, nizyo, ans;

	while(1){
		cin >> x >> h;
		if(x == 0 && h == 0){
			break;
		} 

		teimen = x * x;
		nizyo =(x / 2) * (x / 2) + (h * h);
		shpm = sqrt(nizyo);
		sh = fabs(shpm);

		sokumen = 4 * x * sh / 2;

		ans = teimen + sokumen;

		cout << ans<< fixed << setprecision(6) << endl;
	}

	return 0;
}

Measured memory_bytes: 1276
# -*- coding: utf-8 -*-
x, N = map(int, input().split())

num_list = list(map(int, input().split()))

i = 0            
while True:
    a = x - i
    b = x +i
    if not a in num_list:
        min_num = a
        break
    elif not b in num_list:
        min_num = b
        break
    else:
        i += 1
            
print(min_num)

Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
int main() {
	int h,w,k;
	cin>>h>>w>>k;
	vector<string> s(h);
	for (auto&& e:s) cin>>e;
	int res=1e9;
	for (int bt=0;bt<1<<(h-1);++bt) {
	    vector<int> p{0};
		for (int i = 1; i < h; ++i) 
	    	if(bt>>(i-1)&1)p.push_back(i);
	    p.push_back(h);
	    int n = p.size() - 1;
	    int cur = n - 1;
	    int l = 0, r = 0;
	    while (l < w) {
	      vector<int> c(n);
	      while (r < w) {
	        for (int t = 0; t < n; ++t) {
	          for (int i = p[t]; i < p[t + 1]; ++i) {
	            c[t] += s[i][r] == '1';
	          }
	        }
	        if (*max_element(begin(c), end(c)) > k) {
	          break;
	        }
	        ++r;
	      }
	      if (l == r) {
        	cur = 1e9;
        	break;
      	}
	      l = r;
	      cur += l < w;
	       

	    }
    	res = min(res, cur);
	}
	cout << res << '\n';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MOD 1000000007
#define MOD2 1000000006
#define TEMPMOD1 998244353
#define TEMPMOD2 998244352
#define INF 1000000000000000007
#define NEGINF -1000000000000000007
#define vll vector<ll> 
#define vvll vector<vector<ll>>
#define pll pair<ll,ll>
#define plll pair<pll,ll>
#define vpll vector<pll>
using namespace std;
typedef long long int ll;

ll modexpo(ll base,ll power)
{
    ll result=1;
    while(power!=0)
    {
        if(power&1)
        {
            result=(result*base)%MOD;
        }
        base=(base*base)%MOD;
        power=power>>1;
    }
    return result;
}

ll modinverse(ll num)
{
    ll temp=MOD-2;
    return modexpo(num,temp);
}
// Summing x*(n-x) x=1,...n-1
ll sum1_x_n(ll n)
{
    ll val1=(n*(n+1)*n)/2;
    ll val2=((2*n)+1);
    val2*=(n*(n+1));
    val2=val2/6;
    ll result=val1-val2;
    result=result%MOD;
    return result;
}
// Summing (n-x) fron x=1 to 
ll nonzero(ll n)
{
    ll result=(n*(n-1))/2;
    result=result%MOD;
    return result;
}

int main()
{
    
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    ll factorial[200010];
    factorial[0]=1;
    for(ll i=1;i<200010;i++)
    {
        factorial[i]=(factorial[i-1]*i)%MOD;
    }
    ll result=0,store;
    ll n,m,k;
    cin>>n>>m>>k;
    
    store=(sum1_x_n(m)*(nonzero(n)))%MOD;
    result=(result+store)%MOD;
    store=(sum1_x_n(n)*(nonzero(m)))%MOD;
    result=(result+store)%MOD;
    result=(result*2)%MOD;
    store=(m*sum1_x_n(n))%MOD;
    result=(result+store)%MOD;
    store=(n*sum1_x_n(m))%MOD;
    result=(result+store)%MOD;
    ll cellno=n*m;
    store=factorial[cellno-2];
    store=(store*modinverse(factorial[k-2]))%MOD;
    store=(store*modinverse(factorial[cellno-k]))%MOD;    
    result=(result*store)%MOD;
    cout<<result;
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<complex>
#include<string>
using namespace std;
int main(){
  string s;
  cin >> s;
  
  int ans = 1000;
  string temp;
  for (int i = 0; i < s.size() - 2; i++) {
    temp = s.substr(i, 3);
    if(ans > abs(stoi(temp) - 753)){
      ans = abs(stoi(temp) - 753);
    }
  }
  cout << ans << endl;
    
}

Measured memory_bytes: 256
def main():
    n,k,q = map(int,input().split())
    pnt = [0]*n
    for i in range(q):
        pnt[int(input())-1] += 1
    for i in range(n):
        if k-q+pnt[i] > 0:
            print('Yes')
        else:
            print('No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 50648
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>

using namespace std;

typedef  pair<int,int> P;
typedef long long LL;
typedef vector<LL> VEC;

const LL INF=1<<30;
const LL MOD=1000000007;






int main(){
    	int n,k;
        cin>>n>>k;
        int ans=1;
        for(int i=0;i<n;++i){
            if(ans*2<ans+k)ans*=2;
            else ans+=k;
        }
    cout<<ans<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 100000005
#define MAX 200005

string str = "NESW";
int yy[4] = {1, 0, -1, 0}, xx[4] = {0, 1, 0, -1};
int a[21][21], n, m, py, px;
int solve(int h, int d){
	int ans = 0;
	for(int i = 0;i < d;i++){
		py = py+yy[h];
		px = px+xx[h];
		if(a[py][px]){
			ans++;
			a[py][px] = 0;
		}
	}
	return ans;
}

int main(){
	int d, y, x, h;
	char c;
	while(cin >> n, n){
		int ans = 0;
		py = px = 10;
		fill((int*)a, (int*)(a+21), 0);
		for(int i = 0;i < n;i++){
			cin >> x >> y;
			a[y][x] = 1;
		}
		cin >> m;
		for(int i = 0;i < m;i++){
			cin >> c >> d;
			for(int j = 0;j < 4;j++)if(c == str[j])h = j;
			ans += solve(h, d);
		}
		if(n-ans == 0)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3096
//Name: Matrix-like Computation
//Level: 1
//Category: やるだけ
//Note:

#include <iostream>
#include <vector>

using namespace std;

bool solve() {
    int N;
    if(!(cin >> N)) return false;
    if(!N) return false;

    vector<vector<int>> v(N+1, vector<int>(N+1, 0));
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j) {
            cin >> v[i][j];
            v[i][N] += v[i][j];
            v[N][j] += v[i][j];
            v[N][N] += v[i][j];
        }
    }
    for(int i = 0; i < N+1; ++i) {
        for(int j = 0; j < N+1; ++j) {
            cout.width(5);
            cout << v[i][j];
        }
        cout << endl;
    }
    return true;
}

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

    while(solve()) ;
    return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
using namespace std;
int main()
{
    using ll = long long;
    ll n;
    cin >> n;
    if(n == 0)
    {
      cout << 0 << endl;
      return 0;
    }
    vector<int> ans;
    ll x = 1;
    for(int i = 0; i < 40; i++)
    {
        if(n == 0) break;
        if (n % (x*(-2)) == 0)
        {
            ans.push_back(0);
        }
        else
        {
            ans.push_back(1);
            n -= x;
        }
        x *= -2;
    }
    reverse(ans.begin(), ans.end());
    for(int i = 0; i < ans.size(); i++)
    {
        cout << ans[i];
    }
    cout << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in)) {

			long A = sc.nextInt();
			long B = sc.nextInt();

			System.out.println(lcm(A, B));
		}
	}

	static long lcm(long a, long b) {

		long gcd = gcd(a, b);
		return gcd * (a / gcd) * (b / gcd);
	}

	static long gcd(long a, long b) {

		long max = Math.max(a, b);
		long min = Math.min(a, b);

		if (max - min == 1) {
			return 1;
		}

		if (max % min == 0) {
			return min;
		} else {
			return gcd(min, max % min);
		}
	}

}


Measured memory_bytes: 21844
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),x=sc.nextInt(),y=sc.nextInt();
	  long min=Long.MAX_VALUE;
	  for(int i=0;i<=Math.max(x, y);i++) {
		  min=Math.min(min, 2*c*i+Math.max(0, x-i)*a+Math.max(0, y-i)*b);
	  }

	  System.out.println(min);
  }
}


Measured memory_bytes: 35784
import sys
from bisect import *

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def solve(x):
    l=bisect_left(aa,x)
    r=n+1
    while l+1<r:
        j=(l+r)//2
        s=x*2-aa[j-1]
        i=bisect_left(aa,s)
        if j-i>n-j:r=j
        else:l=j
    ans=cs[n]-cs[l]
    if n-(n-l)*2>0:ans+=+cs2[n-(n-l)*2]
    print(ans)

n,q=MI()
aa=LI()
cs=[0]
cs2=[0]*(n+1)
for i,a in enumerate(aa):
    cs.append(cs[-1]+a)
    if i<2:cs2[i+1]=a
    else:cs2[i+1]=cs2[i-1]+a

for _ in range(q):
    x=II()
    solve(x)

Measured memory_bytes: 24544
#include <stdio.h>
#include <string.h>
void print(char *c, int a, int b) {
  for (int i = a; i <= b; i++) {
    printf("%c", c[i]);
  }
  printf("\n");
}
void replace(char *c, int a, int b, char *str) {
  int count = 0;
  for (int i = a; i <= b; i++) {
    c[i] = str[count++];
  }
}
void reverse(char *c, int a, int b) {
  int count = b-a;
  char tmp[b-a+1];
  for (int i = a; i <= b; i++) {
    tmp[count--] = c[i];
  }
  replace(c,a,b,tmp);
}
int main() {
  char str[1001],order[8],substr[1001];
  int num,a,b;
  scanf("%s", str);
  scanf("%d", &num);
  for (int i = 0; i < num; i++) {
    scanf("%s %d %d", order, &a, &b);
    if (strcmp(order, "replace") == 0) {
      scanf("%s", substr);
      replace(str,a,b,substr);
    }
    else if (strcmp(order, "reverse") == 0) {
      reverse(str,a,b);
    }
    else {
      print(str,a,b);
    }
  }
  return 0;
}



Measured memory_bytes: 2688
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//ここまでテンプレ
int main(){
	int N;
	cin>>N;
	vint node[SIZE];
	for(int i=0;i<N-1;i++){
		int a,b;
		cin>>a>>b;
		a--,b--;
		node[a].pb(b);
		node[b].pb(a);
	}
	int K;
	cin>>K;
	int num[SIZE]={};
	for(int i=0;i<N;i++)
		num[i]=INF;
	priority_queue<pint,vector<pint>,greater<pint>> que;
	for(int i=0;i<K;i++){
		int v,p;
		cin>>v>>p;
		v--;
		num[v]=p;
		que.push(mp(p,v));
	}
	while(que.size()){
		int v,p;
		tie(p,v)=que.top();
		que.pop();
		for(int i:node[v]){
			if(num[i]==INF){
				num[i]=p+1;
				que.push(mp(p+1,i));
			}
			else if(num[i]!=num[v]+1 && num[i]!=num[v]-1){
				cout<<"No"<<endl;
				return 0;
			}
		}
	}
	cout<<"Yes"<<endl;
	for(int i=0;i<N;i++)
		cout<<num[i]<<endl;
	return 0;
}

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

using namespace std;

using ll = long long;

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

    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

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

    ll space = 1;
    ll j = n - 1;
    ll next = *a.rbegin();
    ll ans = 0;
    for (int i = 1; i < n; i++) {
        ll num = a[n-1 - i];
        ans += next;
        if (space - 1 == 0) {
            space = 2;
            j--;
            next = a[j];
        }
        else {
            space--;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using ll = long long;
using ull = unsigned long long;
#define repi(n) for (long long i = 0; i < (n); ++i)
#define repj(n) for (long long j = 0; j < (n); ++j)
#define repk(n) for (long long k = 0; k < (n); ++k)
#define rep(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(itr) for (auto&& v : (itr))
#define updatemax(t, v) (t = std::max(t, (v)))
#define updatemin(t, v) (t = std::min(t, (v)))

#include <boost/operators.hpp>

class modint : private boost::operators<modint>, private boost::equivalent<modint> {
  modint(const long long x, const bool y)
      : x(x) {}

 public:
  static long long M;
  long long x;
  modint(const long long x = 0)
      : x((x % M + M) % M) {}
  modint operator-() const { return modint(x ? M - x : 0, true); }
  modint& operator+=(const modint& b) { return ((x += b.x) >= M ? x -= M : 0), *this; }
  modint& operator++() { return (++x >= M ? x -= M : 0), *this; }
  modint& operator-=(const modint& b) { return ((x -= b.x) < 0 ? x += M : 0), *this; }
  modint& operator--() { return (--x < 0 ? x += M : 0), *this; }
  modint& operator*=(const modint& b) { return x = x * b.x % M, *this; }
  modint& operator/=(const modint& b) { return *this *= b.pow(-1); }
  modint pow(long long b) const {
    long long r = 1, a = x;
    b = (b % (M - 1) + (M - 1)) % (M - 1);
    while (b) {
      if (b & 1) r = r * a % M;
      b = b >> 1;
      a = a * a % M;
    }
    return modint(r, true);
  }
  friend bool operator<(const modint& a, const modint& b) { return a.x < b.x; }
  friend std::istream& operator>>(std::istream& s, modint& a) { return s >> a.x, a = a.x, s; }
  friend std::ostream& operator<<(std::ostream& s, const modint& a) { return s << a.x; }
};
long long modint::M = 1e9 + 7;

int main() {
  int n;
  ll k;
  cin >> n >> k;
  vector<modint> fact(n + 1), factinv(n + 1);
  fact[0] = factinv[0] = 1;
  repi(n) {
    fact[i + 1] = fact[i] * (i + 1);
    factinv[i + 1] = factinv[i] / (i + 1);
  }
  modint res(0);
  repi(min((ll)n, k + 1)) {
    res += factinv[i] * factinv[n - i] * factinv[i] * factinv[n - 1 - i];
  }
  cout << res * fact[n] * fact[n - 1] << endl;
}


Measured memory_bytes: 6328
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18) + 1;
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll n, k;
vector<ll> a;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> k>>n;
    for (int i = 0; i < n; i++)
    {
        ll temp;
        cin >> temp;
        a.push_back(temp);
    }
    vector<ll> sa;
    sa.push_back(k-a[n-1]+a[0]);
    rep(i,n-1){
        sa.push_back(a[i+1]-a[i]);
    }
    sort(ALL(sa));
    cout << k-sa[n-1] << "\n";
}


Measured memory_bytes: 4848
package main
  
import (
    "fmt"
)

func main() {
    var n int
    fmt.Scan(&n)
    var ng bool
    var max int
    for i := 0; i < n; i++ {
        var h int
        fmt.Scan(&h)
        if h < max-1 {
            ng = true
        }
        if h > max {
            max = h
        }
    }
    if ng {
        fmt.Println("No")
    } else {
        fmt.Println("Yes")
    }
}


Measured memory_bytes: 5504
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
using namespace std;

int main(void){
    
    int k,x;
    cin>>k>>x;

    int start = x-k+1;
    int end = x+k-1;
    if(start < -1000000) start = -1000000;
    if(end>1000000) end = 1000000;
    for(int i=start;i<end+1;i++){
        cout<<i<<" ";
    }
    cout<<endl;
    return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
const int MOD = 1000000007;

void solve() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vi l(q), r(q);
  rep(i, q) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    l[i] = a, r[i] = b;
  }
  vi sum(n);
  for(int i = 1; i < n; i++) {
    if (s.substr(i-1, 2) == "AC") sum[i] = sum[i-1] + 1;
    else sum[i] = sum[i-1];
  }

  rep(i, q) {
    cout << sum[r[i]] - sum[l[i]] << endl;
  }
}

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

Measured memory_bytes: 2176
import fractions
from functools import reduce

N, X = map(int, input().split())
L = list(map(int, input().split()))

# move1 = D
# move2 = -D


# D = 1のときは必ずゴールできる
ans = []
# 初期のXとそれ以外の街の差をDで割ったあまりが全て0なら訪れることができる
# つまりそれぞれの街の差を保存し、その最大公約数がDとなる
for i in range(N):
    dfe = abs(L[i] - X)
    ans.append(dfe)

ans = list(set(ans))

# reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]
# functoolsのreduceはある関数があり、それを前の計算結果と重なりを考慮しながら
# 関数に当てはめる、というアクションを繰り返す


def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


# print(ans)
# print(reduce(lambda x, y: x + y, ans))
print(gcd_list(ans))


Measured memory_bytes: 97172
#include <stdio.h>

inline bool check(int n)
{
    for(int x = 1; x * x <= n; x++)
    {
        if((n - x) % (2 * x + 1) == 0)
        {
            return true;
        }
    }
    
    return false;
}

int main()
{
    int n, q, c = 0;
    
    scanf("%d", &q);
    
    for(int i = 0; i < q; i++)
    {
        scanf("%d", &n);
        
        c += check(n) ? 0 : 1;
    }
    
    printf("%d\n", c);
    
    return 0;
}

Measured memory_bytes: 2664
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int prime[1000000];
int Prime_creat()
{
    int i,j;
    for(i=2;i<=1000000;i++)
    {
        if(prime[i])
        {
            for(j=i+i;j<=1000000;j+=i)
            prime[j]=0;
        }
    }
}
int main()
{
    int i,n,ans;
    memset(prime,1,sizeof(prime));//  1是素数 0不是素数
    Prime_creat();
    while(scanf("%d",&n)!=EOF)
    {
        ans=0;
        for(i=2;i<=n;i++)
        {
            if(prime[i])
            ans++;
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 5120
import java.util.*;
import java.util.stream.*;
class Main {
    public static void main(String[] args) {
        Scanner input;
        input = new Scanner(System.in);
        int N = input.nextInt();
        int Y = input.nextInt();
        int a = -1;
        int b = -1;
        int c = -1;
        boolean flag = false;
        for (int i = 0; i < N+1; i++){
            if (flag){
                break;
            }
            for (int j = 0; j < N+1-i; j++){
                if (i*10000 + j*5000 + (N-i-j)*1000 == Y && (N-i-j) >= 0){
                    a = i;
                    b = j;
                    c = N-i-j;
                    flag = true;
                    break;
                }
            }
        }
        System.out.printf("%d %d %d %n",a,b,c);

    }
}

Measured memory_bytes: 23892
//69行目から編集
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define repn for(int i = 0;i < n;i++)
#define ain(a) for(auto& i : a)cin >> i;
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x.size()) 
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define cont continue

//Simple Array Input
#define SAI int n;cin >> n;vi a(n);ain(a)
//Simple Graph Input
#define SGI(m) for(int i=0;i<m;i++){int a,b;cin >> a >> b;g[--a].pb(--b);g[b].pb(a);}
//Simple Tree Input
#define STI SGI(n-1)

typedef long long ll;
typedef long long integer;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vvl;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

template<class T> bool chmin(T& a,T b){if(a > b){a = b;return true;}else return false;}
template<class T> bool chmax(T& a,T b){if(a < b){a = b;return true;}else return false;}
template<class T> void print(std::vector<T> a){
    for(int i=0;i<a.size();i++)cout << a[i] << (i < a.size()-1 ? ' ' : '\n');
}
///////////////////////////////////////////////////////////
ll dp[2020][2020];

int main(int argc, char const *argv[])
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;cin >> n;
	vector<pl> a(n);

	rep(i,n)cin >> a[i].first;
	rep(i,n)a[i].second = i;

	sort(a.begin(),a.end());
	reverse(a.begin(),a.end());

	for(int i = 0;i < n;i++){
		for(int j = 0;j <= i;j++){
			dp[i+1][j+1] = max(dp[i+1][j+1] ,dp[i][j] + a[i].first * (a[i].second - j));
			dp[i+1][j] = max(dp[i+1][j] , dp[i][j] + a[i].first * (n - 1 - (i - j) - a[i].second));
		}
	}

	ll ans = 0;
	rep(i,n+1)chmax(ans,dp[n][i]);
	cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 26372
#include <bits/stdc++.h>
#define ll long long int 
using namespace std;
int main() 
{
        ll n;
        cin>>n;
        ll cnt = n+1;
        for(ll i=1;i<=sqrt(n);i++)
        {
            if(n%i == 0 && (i + n/i) <= cnt )
                cnt = i + n/i ;
        }

        cout<<cnt-2<<endl;

}


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

int main(int argc, char *argv[]){
  int t;
  while(cin >> t, t){
    int time[t];
    for (int i = 0; i < t; i++) {
      cin >> time[i];
    }
    int n, max_day = 0;
    cin >> n;
    int plan[100];
    for (int i = 0; i < 100; i++) {
      plan[i] = 24;
    }
    for (int i = 0; i < n; i++) {
      int d, m;
      cin >> d >> m;
      d--;
      plan[d] = min(plan[d], m);
      max_day = max(max_day, d);
    }
    max_day++;
    int dp[t][max_day + 1];
    for (int i = 0; i <= max_day; i++) {
      for (int j = 0; j < t; j++) {
        dp[j][i] = 1e9;
      }
    }
    dp[0][0] = 0;
    for (int i = 0; i < max_day; i++) {
      for (int j = 0; j < t; j++) {
        if(time[j] <= plan[i]){
          dp[(j + 1) % t][i + 1] = min(dp[(j + 1) % t][i + 1],
                                       dp[j][i]);
        }
        dp[1][i + 1] = min(dp[1][i + 1], dp[j][i] + 1);
      }
    }
    int ans = 1e9;
    for (int i = 0; i < t; i++) {
      ans = min(ans, dp[i][max_day]);
    }
    std::cout << ans << std::endl;
  }
  return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

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

	vector<bool> ans(4, true);
	ans[a] = ans[b] = false;
	for (int i = 1; i <= 3; ++i) {
		if (ans[i]) { cout << i << endl; }
	}
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int n,m;
    cin >> n >> m;
    vs a(n),b(n);
    rep(i,n)cin >> a[i];
    rep(i,n)cin >> b[i];
    int ans = 0;
    rep(i,n)rep(j,m)if(a[i][j] != b[i][j])ans++;
    cout << ans << endl;
}



Measured memory_bytes: 11104
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n,m,k;
  cin>>n>>m>>k;
  ll ans=n*m-k;
  bool flag=false;
  rep(i,n+1){
    rep(j,m+1){
      ll tmp=(i*j)+(n-i)*(m-j);
      if(ans==tmp) flag=true;
    }
  }
  if(flag) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
sx,sy,tx,ty=map(int,input().split())
dx=tx-sx
dy=ty-sy

moji=""
moji+="U"*dy+"R"*dx
moji+="U"+"L"*(dx+1)+"D"*(dy+1)+"R"
moji+="D"+"R"*(dx+1)+"U"*(dy+1)+"L"
moji+="D"*(dy)+"L"*(dx)

print(moji)

Measured memory_bytes: 9180
#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define M 1000000007
//#define M 998244353
using namespace std;
const int inf=4e18;
const double pi=3.14159265358979;
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	int a1,a2,a3;cin>>a1>>a2>>a3;
	if(a1+a2+a3>=22)
		cout<<"bust\n";
	else
		cout<<"win\n";
}

Measured memory_bytes: 256
// ITP1_4_D:   Min, Max and Sum
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>

int main()
{
	int n;
	int d, min, max;
	long long sum;

	scanf("%d%d", &n, &d);
	sum = min = max = d;
	while (--n > 0) {
		scanf("%d", &d);
		if (d < min) min = d;
		if (d > max) max = d;
		sum += d;
	}
	printf("%d %d %lld\n", min, max, sum);
	return 0;
}


Measured memory_bytes: 2112
import java.util.Scanner;
import java.lang.Math;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long k = sc.nextLong();

        long count = 0;

        for(long i=k; i<=n+1; i++){
            count = count + i*(n-i+1)+1;
        }
        System.out.print(count%1000000007);
    }
}

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

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

  if(N<=111)
    cout << "111" << endl;
  else if(N<=222)
    cout << "222" << endl;
  else if(N<=333)
    cout << "333" << endl;
  else if(N<=444)
    cout << "444" << endl;
  else if(N<=555)
    cout << "555" << endl;
  else if(N<=666)
    cout << "666" << endl;
  else if(N<=777)
    cout << "777" << endl;
  else if(N<=888)
    cout << "888" << endl;
  else if(N<=999)
    cout << "999" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main()
{
  ll H, W, K;
  cin >> H >> W >> K;
  vector<string> c(H);
  rep(i, H){
    cin >> c.at(i);
  }
  ll ans = 0;
  rep(i, 1 << H){
    rep(j, 1 << W){
      bitset<6> s(i);
      bitset<6> t(j);
      vector<string> d(H);
      rep(k, H){
        d.at(k) = c.at(k);
      }
      rep(k, H){
        if(s.test(k)){
          rep(l, W){
            d.at(k).at(l) = '.';
          }
        }
      }
      rep(k, W){
        if(t.test(k)){
          rep(l, H){
            d.at(l).at(k) = '.';
          }
        }
      }
      ll cnt = 0;
      rep(k, H){
        rep(l, W){
          if(d.at(k).at(l) == '#'){
            cnt++;
          }
        }
      }
      if(cnt == K){
        ans++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<math.h>
#define PI 3.141592
#define EPS 0.0001
int i,j,f;
double P[4][2],L[4],C[4],x;

double d(double p[2],double q[2])
{
	double e=p[0]-q[0],f=p[1]-q[1];
	double r=sqrt(e*e+f*f);
	return r;
}

int main()
{
	for(;~scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&P[0][0],&P[0][1],&P[1][0],&P[1][1],&P[2][0],&P[2][1],&P[3][0],&P[3][1]);)
	{
		for(j=f=0;j<4;j++)L[j]=d(P[j],P[(j+1)%4]);
		C[0]=(pow(L[0],2)+pow(L[1],2)-pow(d(P[0],P[2]),2))/(2*L[0]*L[1]);
		C[1]=(pow(L[1],2)+pow(L[2],2)-pow(d(P[1],P[3]),2))/(2*L[1]*L[2]);
		C[2]=(pow(L[2],2)+pow(L[3],2)-pow(d(P[0],P[2]),2))/(2*L[2]*L[3]);
		C[3]=(pow(L[3],2)+pow(L[0],2)-pow(d(P[1],P[3]),2))/(2*L[3]*L[0]);
		x=0.0;
		for(i=0;i<4;i++)
			x+=acos(C[i])/PI*180.0;
		puts(x-360>EPS||x-360<-EPS?"NO":"YES");
	}
	return 0;
}

Measured memory_bytes: 652
module Main where

import Control.Applicative
import Numeric
import Data.Char

main :: IO ()
main = do
  { ln <- getLine
  ; putStrLn (map conv ln)
  }

conv :: Char -> Char
conv c | isLower c = toUpper c
       | otherwise = toLower c

--
getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn .  unwords . map show

getDoubles :: IO [Double]
getDoubles = map read . words <$> getLine

putDoubles :: [Double] -> IO ()
putDoubles = putStrLn . unwords . map showDouble

showDouble :: Double -> String
showDouble d = showFFloat Nothing d ""



Measured memory_bytes: 3920
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;

struct point
{
	int x, y, cost;
};

int main(void)

{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << ketasitei;

	int h, w;
	cin >> h >> w;
	vector<string> s(h);
	rep(i, h)
	{
		cin >> s[i];
	}
	for (int i = 0; i < h; i++)
	{
		s[i].push_back(s[i][w - 1]);
		s[i].push_back('#');
	}
	for (int i = 0; i < h; i++)
	{
		for (int j = w; j > 0; j--)
		{
			s[i][j] = s[i][j - 1];
		}
		s[i][0] = '#';
	}
	s.push_back(s[0]);
	s.push_back(s[0]);
	for (int i = 0; i < w + 2; i++)
	{
		s[s.size() - 1][i] = '#';
	}
	for (int i = h; i > 0; i--)
	{
		s[i] = s[i - 1];
	}
	s[0] = s[s.size() - 1];


	int ans = 0;
	for (int i = 1; i <= h; i++)
	{
		for (int j = 1; j <= w; j++)
		{
			if (s[i][j] == '#')
				continue;

			for (int ii = 1; ii <= h; ii++)
			{
				for (int jj = 1; jj <= w; jj++)
				{

					vector<vector<bool>> saerched(h + 2, vector<bool>(w + 2, false));

					if (s[ii][jj] == '#')
						continue;
					queue<point> bfs;
					point p;
					p.y = i; p.x = j - 1; p.cost = 1;
					bfs.push(p);
					p.x = j + 1;
					bfs.push(p);
					p.y = i - 1; p.x = j;
					bfs.push(p);
					p.y = i + 1;
					bfs.push(p);
					saerched[i][j] = true;

					while (!bfs.empty())
					{
						point pp = bfs.front();
						bfs.pop();
						if (saerched[pp.y][pp.x])
							continue;
						if (s[pp.y][pp.x] == '#')
							continue;
						if (pp.y == ii && pp.x == jj)
						{
							ans = max(ans, pp.cost);
							break;
						}
						saerched[pp.y][pp.x] = true;
						point tmp;
						tmp.x = pp.x - 1; tmp.y = pp.y; tmp.cost = pp.cost + 1;
						bfs.push(tmp);
						tmp.x = pp.x + 1;
						bfs.push(tmp);
						tmp.y = pp.y - 1; tmp.x = pp.x;
						bfs.push(tmp);
						tmp.y = pp.y + 1;
						bfs.push(tmp);
					}

				}
			}
		}
	}cout << ans << endl;

	return 0;
}

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

using namespace std;

int main() {
  int S;
  cin >> S;
  vector<long long> dp(S+1);
  dp[0] = 1;
  for (int i = 3; i <= S; ++i)
    dp[i] = (dp[i-1] + dp[i-3]) % 1000000007;
  cout << dp[S] << endl;
}


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

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

using ll = long long;
#define INF 1e9

int main(){
  int N, L;
  cin >> N >> L;
  int sum = 0, ans = L;
  REP(i, N){
    int r = L+(i+1) -1;
    sum += r;
    if(abs(ans) > abs(r)){
      ans = r;
    }
  }
  cout << sum - ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define ll long long
#define ull unsigned long long
#define endl '\n'
#define pb push_back
#define mp make_pair
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

const ll v = 3001;
ll dp[v][v];

ll length(string& s,string& t,ll i,ll j)
{
   // memset(dp,-1,sizeof(dp));
    //Base case
    if(i>=s.size() || j>=t.size())
    return 0;

    //Lookup
    if(dp[i][j] != -1)
    return dp[i][j];

    //Rec case
    if(s[i] == t[j])
    return dp[i][j] = 1 + length(s,t,i+1,j+1);

    else
    return dp[i][j] = max(length(s,t,i+1,j), length(s,t,i,j+1));
}

int main()
{
   fast_io;
    string s,t;
    cin>>s>>t;
     memset(dp,-1,sizeof(dp));

    //cout<<length(s,t,0,0)<<endl;
  ll len = length(s,t,0,0);
  ll i=0,j=0;

   string ans = " ";
   while(len)
   {
       if(s[i] == t[j])
       {
           ans.pb(s[i]);
           i++;
           j++;
           len--;
       }
       else
       {
           if(dp[i][j+1] > dp[i+1][j])
           j++;
           else
           i++;
       }
   }
   cout<<ans<<endl;
   return 0;
}

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

int main() {
	int N;
  	cin >> N;
  
  	vector<int> vec(N);
  
  	for(int i = 0; i < N; i++) {
    	cin >> vec.at(i);
    }
  
  	sort(vec.begin(),vec.end());
  	int sum = 0;
  
  	for(int i = 0 ; i < N - 1; i++){
    	sum += vec.at(i);
    }
  
  	cout << sum + (vec.at(N - 1) / 2) << endl;
}

Measured memory_bytes: 256
/**
*  author: rits1272
*  created: Aug 29, 2020
**/
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define print(x) cout << "[" << #x << ":" << x << "] "; 
#define println(x) cout << "[" << #x << ":" << x << "]\n";

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int d, t, s;
    cin >> d >> t >> s;
    double time = (float) d/s;
    if(time > t)
	cout << "No\n";
    else
	cout << "Yes\n";
    return 0;
}


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

using namespace std;
typedef long long ll;

int ar[501][3];
int main() {
    int n;cin>>n;
    for(int i=0;i<n-1;i++) {
        for(int j=0;j<3;j++) cin>>ar[i][j];
    }
    for(int i=0;i<n-1;i++) {
        ll sum = ar[i][1];
        for(int j=i;j<n-1;j++) {
            sum = ((sum-1) / ar[j][2] + 1) * ar[j][2];
            if(sum < ((ar[j][1]-1) / ar[j][2] + 1) * ar[j][2]) 
                sum = ((ar[j][1]-1) / ar[j][2] + 1) * ar[j][2];
            sum += ar[j][0];
        }
        cout<<sum<<"\n";
    }
    cout<<"0\n";
}

Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
bool cmp(char a, char b){
return a > b;
}
int main(){
    string s, t;
    cin >> s; 
    cin >> t; 
    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), cmp);
    if (s < t)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,y,s=0,s1=0,count=0;
    cin>>x>>y;
ios::sync_with_stdio(0);
    if(x==3){s=100000;}
    else if(x==2){s=200000;}
    else if(x==1){s=300000;}

     if(y==3){s1=100000;}
    else if(y==2){s1=200000;}
    else if(y==1){s1=300000;}



    count=s+s1;
    if(count==600000){cout<<"1000000"<<endl;}
    else
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 256
// ITP_MatrixMultiplication.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
	int l, m, n;
	string s;
	long long int a;
	cin >> n >> m >> l;
	vector<vector<long long int>> A;
	vector<vector<long long int>> B;
	A.clear(); A.resize(n);
	B.clear(); B.resize(m);
	for (int y = 0; y < n; ++y) {
		for (int x = 0; x < m; ++x) {
			cin >> s;
			A[y].push_back(stoi(s.c_str()));
		}
	}
	for (int y = 0; y < m; ++y) {
		for (int x = 0; x < l; ++x)
		{
			cin >> s;
			B[y].push_back(stoi(s.c_str()));
		}
	}
	vector<vector<long long int>> C;
	C.clear(); C.resize(n);
	for (int i = 0; i < n; ++i) C[i].resize(l);
	for (int x = 0; x < n; ++x) {
		for (int y = 0; y < l; ++y) {
			C[x][y] = 0;
			for (int z = 0; z < m; ++z) {
				C[x][y] += A[x][z] * B[z][y];
			}
		}
	}
	for (int x = 0; x < n; ++x) {
		for (int y = 0; y < l; ++y) {
			if (y != l - 1) {
				cout << C[x][y] << " ";
			}
			else {
				cout << C[x][y];
			}
		}
		cout << endl;
	}
}



Measured memory_bytes: 3284
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

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

    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            ans += d[i] * d[j];
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int N;
  cin >> N;
  int a[N];
  bool rate[8];
  int god = 0;
  for(int i = 0; i < N; ++i){
    cin >> a[i];
  }
  for(int j = 0; j < 8; ++j) rate[j] = false;
  for(int i = 0; i < N; ++i){
    for(int j = 0; j < 8; ++j){
      if(400*j <= a[i] && a[i] < 400*(j+1)) rate[j] = true;
    }
    if(a[i] >= 3200) ++god;
  }
  int countmin = 0;
  for(int j = 0; j < 8; ++j){
    if(rate[j]) ++countmin;
  }
  int countmax = countmin + god;
  if(countmin == 0) countmin = 1;
  cout << countmin << ' ' << countmax <<endl;  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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 pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007,INF=1e18;
int dy[]={0,-1,1,0};
int dx[]={1,0,0,-1};

#define int ll


int h,w,cnt=0,ans=0;
int a[555][555],b[555][555];
vpint xx,yy;

signed main(){
    cin>>h>>w;
    

    int odd=0;
    rep(i,0,h)rep(j,0,w){
        cin>>a[i][j];
        if(a[i][j]&1)odd++;
    }
    int num = 0;
    int x = 0, y = 0;
    for (int iter = 0; iter < w*h; ++iter) {
        if (a[x][y] & 1) ++num;
            
        int nx = x, ny = y;
        if (x % 2 == 0) {
            if (ny == w-1) ++nx;
            else ++ny;
        }
        else {
            if (ny == 0) ++nx;
            else --ny;
        }
        if (num & 1) if (num < odd){
             xx.push_back(pint(x, y));
             yy.pb(pint(nx,ny));
        }
        x = nx, y = ny;
    }
    cout<<xx.size()<<endl;
    rep(i,0,xx.size()){
        cout<<xx[i].fi+1<<" "<<xx[i].se+1<<" "<<yy[i].fi+1<<" "<<yy[i].se+1<<endl;
    }
    return 0;
}

Measured memory_bytes: 6764
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const unsigned int M = 1000000007;
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int a,b,c;
    while(cin>>a>>b>>c){
        b-a==c-b?cout<<"YES"<<endl:cout<<"NO"<<endl;
    }
}


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

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
    int n, m; cin >> n >> m;
    vector<int> a(m); rep(i, m) cin >> a[i];
    int sum = accumulate(a.begin(), a.end(), 0);
    if (sum <= n) cout << n - sum << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 3668