akhauriyash/Code-Regression huggingface dataset:
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, N);
    vi ans(N + 1);
    REP1(x, 100)
    {
        REP1(y, 100)
        {
            REP1(z, 100)
            {
                ll t = x * x + y * y + z * z + x * y + y * z + z * x;
                if (t <= N)
                {
                    ++ans[t];
                }
            }
        }
    }
    REP1(i, N)
    {
        OUT(ans[i]);
    }
}

Measured memory_bytes: 3700
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;
list<int> Prime(int M) {
	list<int>P;
	P.push_back(2);
	P.push_back(3);
	for (int i = 5; i <= M; i += 6) {
		bool flag = true;
		for (auto j : P) {
			if (i%j == 0) {
				flag = false;
				break;
			}
		}
		if (flag)P.push_back(i);
		flag = true;
		for (auto j : P) {
			if ((i + 2) % j == 0) {
				flag = false;
				break;
			}
		}
		if (flag)P.push_back(i + 2);
	}
	return P;
}


long long int N;
long long int ans;

int H, W, Q;
int field[3000][3000];
int sum[3000][3000];
int yoko[3000][3000];
int tate[3000][3000];
string s[3000];

int main() {
	ios::sync_with_stdio(false);
	cin >> H >> W>>Q;
	for (int i = 1; i <= H; i++) {
		cin >> s[i];
	}
	for (int i = 1; i <= H; i++) {
		for (int j = 0; j < W; j++) {
			field[i][j+1] = (s[i][j] - '0');
		}
	}
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			sum[i][j] = sum[i][j - 1] + field[i][j];
			if (field[i][j] && field[i][j + 1])yoko[i][j]++;
		}
	}
	for (int j = 1; j <= W; j++) {
		for (int i = 1; i <= H; i++) {
			sum[i][j] += sum[i - 1][j];
			if (field[i][j] && field[i + 1][j])tate[i][j]++;
		}
	}
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			tate[i][j] += tate[i][j - 1];
			yoko[i][j] += yoko[i][j - 1];
		}
	}
	for (int j = 1; j <= W; j++) {
		for (int i = 1; i <= H; i++) {
			tate[i][j] += tate[i - 1][j];
			yoko[i][j] += yoko[i - 1][j];
		}
	}
	for (int i = 0; i < Q; i++) {
		int sy, sx, gy, gx;
		cin >> sy >> sx >> gy >> gx;
		cout << (sum[gy][gx] - sum[gy][sx - 1] - sum[sy - 1][gx] + sum[sy - 1][sx - 1]) - (yoko[gy][gx - 1] - yoko[gy][sx - 1] - yoko[sy - 1][gx - 1] + yoko[sy - 1][sx - 1]) - (tate[gy - 1][gx] - tate[gy - 1][sx - 1] - tate[sy - 1][gx] + tate[sy - 1][sx - 1]) << endl;
	}
	return 0;
}

Measured memory_bytes: 104320
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stdlib.h>
#include <cmath>
#include <math.h>
#include <fstream>
#include <bitset>
#define int long long
using namespace std;
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, ai;
    vector<int> data;
    cin >> n;
    for (int i=0; i < n;i++){
        cin >> ai;
        data.push_back(ai);
    }
    int z = 0, o = 0, t = 0;
    for (int i=0; i < n; i++){
        if (data[i] % 2 != 0){
            z++;
        }
        else if (data[i] % 4 != 0){
            o++;
        }
        else t++;
    }
    if (t >= z){
        cout << "Yes" << endl;
    }
    else{
        if (z - t == 1 && z + t == n){
            cout << "Yes" << endl;
        }
        else cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef long double ld;


int main() {
  int N;
  cin>>N;
  int p,x;
  for(int i=0;i<N;i++){
    cin>>p;
    if(p!=i+1){
       x++;
    }
   
  }
  if(x<3){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }


 
}

Measured memory_bytes: 256
#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>
#include<map>

using namespace std;
using ll = long long;
using vec = vector<int>;
using mat = vector<vec>;
using lst = list<ll>;

ll MOD = 1000000007;

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

	double ans=0;
	for(int i=0;i<N;++i)
	{
		double A; cin >> A;
		ans += 1 / A;
	}

	printf("%.10f\n", 1/ans);
	

	return 0;
}

Measured memory_bytes: 256
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(dead_code)]

use itertools::Itertools;
use proconio::input;
use proconio::marker::{Chars, Usize1};

#[allow(unused_macros)]
#[cfg(debug_assertions)]
macro_rules! mydbg {
    //($arg:expr) => (dbg!($arg))
    //($arg:expr) => (println!("{:?}",$arg));
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
}
#[cfg(not(debug_assertions))]
macro_rules! mydbg {
    ($($arg:expr),*) => {};
}

macro_rules! echo {
    ($($a:expr),*) => {
          $(println!("{}",$a))*
      }
}

use std::cmp::*;
use std::collections::*;
use std::ops::{Add, Div, Mul, Sub};

#[allow(dead_code)]
static INF_I64: i64 = 92233720368547758;
#[allow(dead_code)]
static INF_I32: i32 = 21474836;
#[allow(dead_code)]
static INF_USIZE: usize = 18446744073709551;
#[allow(dead_code)]
static M_O_D: usize = 1000000007;
#[allow(dead_code)]
static PAI: f64 = 3.1415926535897932;

trait IteratorExt: Iterator {
    fn toVec(self) -> Vec<Self::Item>;
}

impl<T: Iterator> IteratorExt for T {
    fn toVec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

trait CharExt {
    fn toNum(&self) -> usize;
    fn toAlphabetIndex(&self) -> usize;
    fn toNumIndex(&self) -> usize;
}
impl CharExt for char {
    fn toNum(&self) -> usize {
        return *self as usize;
    }
    fn toAlphabetIndex(&self) -> usize {
        return self.toNum() - 'a' as usize;
    }
    fn toNumIndex(&self) -> usize {
        return self.toNum() - '0' as usize;
    }
}

trait VectorExt {
    fn joinToString(&self, s: &str) -> String;
}
impl<T: ToString> VectorExt for Vec<T> {
    fn joinToString(&self, s: &str) -> String {
        return self
            .iter()
            .map(|x| x.to_string())
            .collect::<Vec<_>>()
            .join(s);
    }
}

trait StringExt {
    fn get_reverse(&self) -> String;
}
impl StringExt for String {
    fn get_reverse(&self) -> String {
        self.chars().rev().collect::<String>()
    }
}

trait UsizeExt {
    fn pow(&self, n: usize) -> usize;
}
impl UsizeExt for usize {
    fn pow(&self, n: usize) -> usize {
        return ((*self as u64).pow(n as u32)) as usize;
    }
}

fn main() {
    input! {
       a: f64,
       b:f64,
       h:f64,
       m:f64,
    }

    let mut t = PAI * 360.0 * (h / 12.0) / 180.0;
    t += PAI * 30.0 * (m / 60.0) / 180.0;
    let t2 = PAI * 360.0 * (m / 60.0) / 180.0;
    mydbg!(t, t2);

    let c = (t - t2).cos();
    let mut ans = a * a + b * b - 2.0 * a * b * c;

    echo!(ans.sqrt());
}


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

using namespace std;

class DisjointSet{
  public:
  vector<int> rank, p;

  DisjointSet(){}
  DisjointSet(int size){
    rank.resize(size, 0);
    p.resize(size, 0);
    for(int i=0; i<size; i++) makeSet(i);
  }

  void makeSet(int x){
    p[x] = x;
    rank[x] = 0;
  }

  bool same(int x, int y){
    return findSet(x) == findSet(y);
  }

  void unite(int x, int y){
    link(findSet(x), findSet(y));
  }

  void link(int x, int y){
    if(rank[x] > rank[y]){
      p[y] = x;
    }else{
      p[x] = y;
      if(rank[x] == rank[y]){
        rank[y]++;
      }
    }
  }

  int findSet(int x){
    if(x != p[x]){
      p[x] = findSet(p[x]);
    }
    return p[x];
  }
};

int main(){
  int n, a, b, q;
  int t;

  cin >> n >> q;
  DisjointSet ds = DisjointSet(n);
 
  for(int i=0; i<q; i++){
    cin >> t >> a >> b;
    if(t == 0) ds.unite(a, b);
    else if(t == 1){
      if(ds.same(a, b)) cout << 1 << endl;
      else cout << 0 << endl;
    }
  }
  
  return 0;
}
    

Measured memory_bytes: 3180
N=int(input())
def tigai(a,b):
  for i in range(10):
    x = (a>>i)%2
    y = (b>>i)%2
    if x!=y:
      return(i+1)

for i in range(1,N):
  print(*[tigai(i,j) for j in range(i+1,N+1)])

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

#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i,a) for (auto i = rbegin(a); i != rend(a); ++i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
using namespace std;
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
ll mod = static_cast<ll>(1e9 + 7);
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr void mins(T& a, Args... args) { a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr void maxs(T& a, Args... args) { a = max<T>({ a,args... }); }
template<class A, int N, class T>
void fillArray(A(&array)[N], const T& val) { std::fill((T*)array, (T*)(array + N), val); }

int h, w;
char s[105][105];
ll dp[105][105];
void solve() {
    cin >> h >> w;
    rep(i, h) rep(j, w) cin >> s[i][j];
    fillArray(dp, inf);
    dp[0][0] = 0;
    if (s[0][0] == '#') ++dp[0][0];
    rep(i, h) rep(j, w) {
        if (s[i + 1][j] != s[i][j] && s[i + 1][j] == '#') {
            mins(dp[i + 1][j], dp[i][j] + 1);
        }
        else {
            mins(dp[i + 1][j], dp[i][j]);
        }

        if (s[i][j + 1] != s[i][j] && s[i][j + 1] == '#') {
            mins(dp[i][j + 1], dp[i][j] + 1);
        }
        else {
            mins(dp[i][j + 1], dp[i][j]);
        }
    }

    cout << dp[h - 1][w - 1] << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 384
#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){
		if((y-r)>=0&&(y+r)<=H){
			printf("Yes\n");
		}else{
			printf("No\n");
		}
	}else{
			printf("No\n");
		}
	
	return 0;
}

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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int64_t n;
  std::cin >> n;
  std::vector<int64_t> a(n);

  std::cin >> a;

  int64_t dp[6], dp_tmp[6];
  dp[0] = 0;     // -1個で最後をとってない
  dp[1] = 0;     // -1個で最後をとった
  dp[2] = a[0];  // 0個で最後をとってない
  dp[3] = a[1];  // 0個で最後をとった
  dp[4] = 0;     // 1個で最後をとってない
  dp[5] = 0;     // 1個で最後をとった.

  for (int64_t i = 2; i < n; i++) {
    if (i % 2 == 0) {
      // 奇数.
      dp_tmp[0] = std::max(dp[0], dp[1]);  // 0
      dp_tmp[1] = 0;                       // 0
      dp_tmp[2] = std::max(dp[2], dp[3]);
      dp_tmp[3] = dp[0] + a[i];
      dp_tmp[4] = 0;  // 0
      dp_tmp[5] = dp[2] + a[i];
    } else {
      // 偶数.
      dp_tmp[0] = std::max(dp[2], dp[3]);
      dp_tmp[1] = dp[0] + a[i];
      dp_tmp[2] = dp[5];
      dp_tmp[3] = dp[2] + a[i];
      dp_tmp[4] = 0;  // 0
      dp_tmp[5] = 0;
    }
    std::swap(dp, dp_tmp);
  }

  std::cout << std::max(dp[2], dp[3]) << std::endl;

  return 0;
}

Measured memory_bytes: 4828
#include <iostream>
using namespace std;
const int INF = 1<<29;

int main(){
	double X[3], Y[3];
	double px, py;
	while( cin >> X[0] >> Y[0] >> X[1] >> Y[1] >> X[2] >> Y[2] >> px >> py ){
		int cnt = 0;
		for( int i=0; i<3; i++ ){
			if( (X[(i+1)%3]-X[i])*(py-Y[i]) - (px-X[i])*(Y[(i+1)%3]-Y[i]) > 0 ) cnt++;
		}
		if( cnt%3 ) cout << "NO" << endl;
		else cout << "YES" << endl;
	}
}

Measured memory_bytes: 1216
N = int(input())
T = list(map(int,input().split()))
V = list(map(int,input().split()))
max_t = sum(T)
vl = [0]*(max_t+1)
vr = [0]*(max_t+1)
vm = [0]*(max_t+1)
t = 0
for s, u in zip(T,V):
  for i in range(t,t+s):
    vm[t] = u
    t += 1
t = 1
for s, u in zip(T,V):
  for i in range(t, t+s):
    vl[t] = min(u, vl[t-1]+1)
    t += 1
t = max_t
for s, u in zip(T[::-1],V[::-1]):
  for i in range(t-s,t)[::-1]:
    vr[t-1] = min(u,vr[t]+1)
    t -= 1
v = [min(vl[i],vr[i]) for i in range(max_t+1)]
#print(vm)
#print(vl)
#print(vr)
#print(v)
ans = 0
for i in range(max_t):
  ans += (v[i] + v[i+1]) / 2
  if v[i] == v[i+1] and v[i] != vm[i]:
    ans += 0.25
print("{:.10f}".format(ans))

Measured memory_bytes: 9572
// https://atcoder.jp/contests/abc089/tasks/abc089_d
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h, w, d, t, q;
    cin >> h >> w >> d;
    vector<pii> v(h * w + d + 1);
    vector<vector<int>> disp(h, vector<int>(w));
    REP(i, h) REP(j, w) {
        cin >> t;
        v[t] = {i, j};
        disp[i][j] = t;
    }
    vector<ll> memo(h * w + 1, 0);
    REP(i, d) {
        int start = i;
        int goal = h * w;
        ll sum = 0;
        while (start < goal) {
            pii posNow = v[start];
            pii posNext = v[start + d];
            int diff = abs(posNow.first - posNext.first) +
                       abs(posNow.second - posNext.second);
            sum += diff;
            start += d;
            if (start > h * w)
                break;
            memo[start] = sum;
        }
    }
    cin >> q;
    vector<pii> s(q);
    REP(i, q) cin >> s[i].first >> s[i].second;
    REP(i, q) cout << memo[s[i].second] - memo[s[i].first] << "\n";

    return 0;
}


Measured memory_bytes: 3712
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {

			var inputArray = retreiveStringArray();
			var inputCount = 1;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			var S = inputArray[0];
			//何回色が変わるか求めればよい
			var count = 0;
			var currentColor = S[0];


			foreach (var c in S) {

				if(c != currentColor) {
					count++;
					currentColor = c;
				}

			}

			//答えの出力
			var ans = count;
			Console.WriteLine(ans);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}
	}
}

Measured memory_bytes: 11744
#include<iostream>
#include<math.h>

using namespace std;

int main(){
  double r0 = 0, w0 = 0, c = 0, r = 0;
  cin >> r0 >> w0 >> c >> r;
  while(r0||w0||c||r){
    double oldnum = ((c*w0)-r0)/r;
    if (oldnum < 0) oldnum = 0;
    cout << ceil(oldnum) << endl;
    cin >> r0 >> w0 >> c >> r;
  }
  return 0;
}

Measured memory_bytes: 3208
import java.io.*;
import java.nio.CharBuffer;
import java.util.NoSuchElementException;

public class Main {

    public static void main(String[] args) {
        SimpleScanner scanner = new SimpleScanner(System.in);
        PrintWriter writer = new PrintWriter(System.out);

        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        writer.println(a + b + c - Math.max(a, Math.max(b, c)));

        writer.close();
    }

    private static class SimpleScanner {

        private static final int BUFFER_SIZE = 10240;

        private Readable in;
        private CharBuffer buffer;
        private boolean eof;

        SimpleScanner(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
            buffer = CharBuffer.allocate(BUFFER_SIZE);
            buffer.limit(0);
            eof = false;
        }


        private char read() {
            if (!buffer.hasRemaining()) {
                buffer.clear();
                int n;
                try {
                    n = in.read(buffer);
                } catch (IOException e) {
                    n = -1;
                }
                if (n <= 0) {
                    eof = true;
                    return '\0';
                }
                buffer.flip();
            }
            return buffer.get();
        }

        void checkEof() {
            if (eof)
                throw new NoSuchElementException();
        }

        char nextChar() {
            checkEof();
            char b = read();
            checkEof();
            return b;
        }

        String next() {
            char b;
            do {
                b = read();
                checkEof();
            } while (Character.isWhitespace(b));
            StringBuilder sb = new StringBuilder();
            do {
                sb.append(b);
                b = read();
            } while (!eof && !Character.isWhitespace(b));
            return sb.toString();
        }

        int nextInt() {
            return Integer.valueOf(next());
        }

        long nextLong() {
            return Long.valueOf(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
typedef long long ll;
#define forn(i, start, end) for (ll i = start; i < ll(end); i++)
#define input(arr, n) forn(i, 0, n) cin >> arr[i];
#define MOD 1000000007
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define vvll vector<vector<ll>>
#define mll map<ll, ll>
#define mcl map<char, ll>
#define sc set<char>
#define sll set<ll>
#define ssll stack<ll>
#define CHK(param) cout << #param << " is : " << param << "\n";
#define pb push_back
#define ppb pop_back
#define mk make_pair
#define f first
#define s second
#define all(x) (x).begin(), (x).end()
#define LAUV                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define TC       \
    ll TTTT;     \
    cin >> TTTT; \
    while (TTTT--)
using namespace std;

int32_t main()
{
    LAUV;
    // TC
    {
        ll x;
        cin >> x;
        ll k=1;
        while((k*x)%360!=0){
            k++;
        }
        cout<<k<<'\n';
    }
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,ans,kakuninn;
  ans=0;
  string str;
  cin>>n>>str;
  for(char i='0'; i<='9'; i++){
    for(char j='0'; j<='9'; j++){
      for(char k='0'; k<='9'; k++){
        kakuninn=1;
        for(int l=0; l<n; l++){
          if(kakuninn==3){
            if(str.at(l)==k){
              ans++;
              break;
            }
          }
          if(kakuninn==2){
            if(str.at(l)==j){
              kakuninn++;
            }
          }
          if(kakuninn==1){
            if(str.at(l)==i){
              kakuninn++;
            }
          }
        }
      }
    }
  }
  cout<<ans;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

func maxInt(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()
	a := readInt()
	b := readInt()
	h := readInt()
	println((a + b) * h / 2)

}


Measured memory_bytes: 640
#include <stdio.h>

int main()
{
	int N,a;
	int flag = 0;
	float b;
	scanf("%d", &N);
	
	
		for (int i = 1; i <= 9; i++)
		{
			a = N % i;
			b = N / i;
			if (a == 0)
			{
				if (b <= 9)
				{
					flag = 1;
				}
			}
		}
		if (flag == 1) {
			printf("Yes");
		}
		else {
			printf("No");
		}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;
using vecint = vector<int>;
using ll = int64_t;
constexpr int INF = 1000000000;

pair<int,int> bfs(vector<vecint>& g, int s) {
  int n=g.size();
  vector<int> d(n,INF);
  d[s] = 0;
  queue<int> q;
  q.push(s);
  while(!q.empty()) {
    int i = q.front();
    q.pop();
    for (int j : g[i]) {
      if (d[j] > d[i]+1) {
        d[j] = d[i]+1;
        q.push(j);
      }
    }
  }
  auto itr = max_element(ALL(d));
  return make_pair(itr-begin(d), *itr);
}

int main()
{
  int n;
  cin>>n;
  vector<vecint> g(n);
  REP(i,n-1) {
    int a,b;
    cin>>a>>b;
    --a;--b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  int s,d;
  tie(s,d) = bfs(g,0);
  int t,D;
  tie(t,D) = bfs(g,s);
  if ((D%3) == 1) {
    cout << "Second" << endl;
  } else {
    cout << "First" << endl;
  }
  return 0;
}


Measured memory_bytes: 13556
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include <complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define ld long double
#define INF 1e+8
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end
using namespace std;
#define PI (acos(-1,p));
typedef pair<int, int> PA;
typedef complex<double>P;
int main(){
    double pi = acos(-1.0);
    int n ;
    while (true) {
        cin >> n; if(n == -1) break;
            P p(1,0);
            rep(i,n-1){
                P t = p;
                t*= P(0,1);
                t = t/abs(t);
                p =p+t;
            }
        printf("%f\n %f\n",p.real(),p.imag());
    }
    return 0;
}

Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

signed main(){
    string s;
    cin >> s;
    int n = s.size();
    rep(i, 0, n){
        if(i + 1 < s.size() && s[i] == s[i + 1]){
            cout << i + 1 << " " << i + 2 << endl;
            return 0;
        }
        if(i + 2 < s.size() && s[i] == s[i + 2]){
            cout << i + 1 << " " << i + 3 << endl;
            return 0;
        }
    }
    cout << -1 << " " << -1 << endl;
}

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

struct BIT{
  int size;
  vector<ll> dat;
  void init(int n){
    size=n;
    dat.clear();
    dat.resize(n+1);
  }
  void Add(int i,ll x){
    while(0<i&&i<=size){
      dat[i]+=x;
      i+=(i&-i);
    }
  }
  ll Sum(int i){
    ll res=0;
    while(0<i){
      res+=dat[i];
      i-=(i&-i);
    }
    return res;
  }
};



int main(){
  int n,q;
  BIT A,B;
  scanf("%d %d",&n,&q);
  A.init(n);
  B.init(n);
  for(int i=1;i<=q;i++){
    int type;
    ll s,t,value;
    scanf("%d",&type);
    if(type==0){
      scanf("%lld %lld %lld",&s,&t,&value);
      A.Add(s,value);
      A.Add(t,-value);
      B.Add(s,-value*(s-1));
      B.Add(t,value*(s-1));
      
      B.Add(t,value*(t-s+1));
    }
    if(type==1){
      scanf("%lld %lld",&s,&t);
      s--;
      printf("%lld\n", A.Sum(t)*t+B.Sum(t) - A.Sum(s)*s-B.Sum(s) );
    }
  }
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef int _lcint;
#define REP(i, n) for (_lcint i = 0; i < n; i++)
#define FOR(i, a, b) for (_lcint i = (_lcint)(a); i < (_lcint)(b); i++)
#define FORREV(i, a, b) for (_lcint i = (_lcint)(b)-1; i >= (_lcint)(a); i--)
#define DEBUG(x) cout << #x << ": " << x << endl;
#define DEBUG_VEC(v)  \
  cout << #v << ": "; \
  REP(i, v.size()) cout << " " << v[i] << endl;

#define ALL(a) (a).begin(), (a).end()
#define CHMIN(a, b) a = min((a), (b))
#define CHMAX(a, b) a = max((a), (b))

struct Info {
  ll A, B;
};

bool operator<(const Info &left, const Info &right) { return left.A < right.A; }

unsigned long long XOR(unsigned long long A, unsigned long long B) {
  return A ^ B;
}

int main() {
  int A, B, K;
  cin >> A >> B >> K;
  int m = min(A, B);

  FORREV(i, 1, m + 1) {
    if (A % i == 0 && B % i == 0) {
      K--;
      if (K == 0) {
        cout << i << endl;
        return 0;
      }
    }
  }
  cout << 1 << endl;

  return 0;
}


Measured memory_bytes: 256
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
#define     FAST        ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     int 	    long long
#define 	pb 	        push_back
#define 	mp 	        make_pair
#define 	pi 	        2*acos(0.0)
#define     scan(i)     scanf("%lld",&i)
#define     scann(i,j)  scanf("%lld%lld",&i,&j)
#define     print(i)    printf("%lld\n",i)
#define     printt(i,j) printf("%lld %lld\n",i,j)
#define     loop(i,n) 	for(int i = 0 ; i <n ; i++)
#define     loopp(i,n) 	for(int i = 1 ; i <=n ; i++)
#define 	vect 	    vector<int>
#define 	vec_it 	    vector<int>::reverse_iterator vi
#define     sorta(v)    sort(v.begin(),v.end())
#define     sortd(v)    sort(v.begin(),v.end(),greater<>())
#define     sorted      is_sorted(v.begin(),v.end())
#define 	mapp 	    map<int,int>
#define 	pairr 	    pair<int,int>
#define 	sett	    set<int>
#define 	set_it 	    set<int>::reverse_iterator si
#define     map_it      map<int,int> :: reverse_iterator mi
#define 	yes 	    cout<<"YES"<<endl
#define 	no 	        cout<<"NO"<<endl
#define 	ff 	        first
#define 	ss 	        second
#define     mx          INT_MAX
#define     lmx         LLONG_MAX
#define     mn          INT_MIN
#define     lmn         LLONG_MIN
#define     GCD         __gcd(a,b)
#define     LCM         (a/GCD)*b
template <typename T> T gcd(T a,T b){return (b==0)?a:gcd(b,a%b);}
template <typename T> T lcm(T a,T b) {return a*(b/gcd(a,b));}
int modulo (int a, int b) { return a >= 0 ? a % b : ( b - abs ( a%b ) ) % b; }

void solve()
{
  //  freopen ("(input).txt" , "r",  stdin) ;
  //  string st,stt ;
  //  int low=0,high=0;
  //  int l=0,r;
    int n,k,t,x,y,z,d=0,temp=0,cnt=0,sum=0,f=0;
    cin>>n>>k  ; vect v(n) ,a ,b  ; sett s ; set_it ; mapp m,mm ;  map_it ; pairr p ;
    loop(i,n)
    {
        cin>>v[i];
        if(i>0)
        {
            if(v[i]+v[i-1]>k)
            {
                if(v[i-1]<=k)
                {
                    sum+=(v[i]+v[i-1])-k;
                    v[i]=(k-v[i-1]);
                }
                else if(v[i-1]>k)
                {
                    sum+=(v[i]+v[i-1])-k;
                    v[i]=0;
                }
            }
        }
    }
    cout<<sum<<endl;


}

main()
{
    int t;
  //  cin>>t;
  //  while(t--)
        solve();
}

Measured memory_bytes: 3952
#include <iostream>
using namespace std;
int main() {
	bool isprime[1000000];
	for (int i = 0; i < 1000000; i++)
		isprime[i] = 1;
	for (int i = 2; i < 1000; i++) {
		if (!isprime[i]) continue;
		for (int j = i * i; j < 1000000; j += i)
			isprime[j] = 0;
	}
	int n;
	while (cin >> n) {
		int ans = 0;
		for (int i = 2; i <= n; i++)
			if (isprime[i])
				ans++;
		cout << ans << endl;
	}
}


Measured memory_bytes: 4060
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){
  int n;
  cin >>n;
  int arr[501];
  for(int i=0;i<n;i++) cin >> arr[i];
  ll ans[501][501];
  for(int l=n-1;l>=0;l--){
    for(int r=l;r<n;r++){
      ll sum=0;
      for(int i=l;i<=r;i++){
        sum+=arr[i];
      }
      ans[l][r]=1e18L+5;
      if(l==r){
        ans[l][r]=0;
      }
      else{
        for(int i=l;i<=r-1;i++){
          ans[l][r]=min(ans[l][r],ans[l][i]+ans[i+1][r]+sum);
        }
      }
    }
  }
//  for(int i=0;i<=n-1;i++)
cout << ans[0][n-1]<<endl;

}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
#include<complex>
using namespace std;

typedef complex<double> P;

namespace std {
  bool operator < (const P& a, const P& b) {
    return imag(a) != imag(b) ? imag(a) < imag(b) : real(a) < real(b);
  }
}

double cross(const P &a, const P &b){
    return imag(conj(a)*b);
}

double dot(const P &a, const P &b){
    return real(conj(a)*b);
}

#define curr(G, i) G[i%n]
#define next(G, i) G[(i+1)%n]

double area(vector<P> &G){
    int n = G.size();

    double S = 0;
    for (int i=0;i<n;i++){
        P p = curr(G, i);
        P q = next(G, i);
        S += (1.0/2)*cross(p, q);
    }

    return S;
}

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

    vector<P> G;
    for (int i=0;i<n;i++){
        P p;
        cin >> p.real() >> p.imag();
        G.push_back(p);
    }

    printf("%.1f\n", area(G));
}

Measured memory_bytes: 3208
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long count = 0;
        for (int i = 1; i <= n; i++) {
            if (i % 3 == 0 || i % 5 == 0)
                continue;
            else
                count += i;
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 35772
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int mod = (int)1e9 + 7, INF = (int)1e9;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };


int main(void) {
    int n, m, i, a, b, ans[100003] = {}, p;
    vector<int> g[100003];
    queue<int> q;

    scanf("%d%d", &n, &m);
    for (i = 0; i < m; i++) {
        scanf("%d%d", &a, &b);
        g[a - 1].push_back(b - 1);
        g[b - 1].push_back(a - 1);
    }

    for (i = 0; i < n; i++) {
        ans[i] = -1;
    }

    q.push(0);
    while (!q.empty()) {
        p = q.front();
        q.pop();
        for (i = 0; i < g[p].size(); i++) {
            if (ans[g[p][i]] == -1) {
                ans[g[p][i]] = p;
                q.push(g[p][i]);
            }
        }
    }

    printf("Yes\n");

    for (i = 1; i < n; i++) {
        printf("%d\n", ans[i] + 1);
    }

    return 0;
}

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

int main() {
    int n;
    char tmp;
    char *s = malloc(sizeof(char)*10000);
    scanf("%d %s", &n, s);
    for (int i = 0; i < strlen(s); i++) {
        tmp = s[i];
        if (s[i] + n > 'Z') {
            s[i] = 'A' + (tmp + n - 'Z') - 1;
        }else {
            s[i] = tmp + n;
        }
    }
    printf("%s\n", s);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<ll, ll>
#define PP pair<P,P>
using namespace std;

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

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

// 出力は.xで！！！！

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};


vector<P> primes(ll n){
    vector<P> res;
    ll lim=n;
    for(int i=2; i<=sqrt(lim); i++){
        if(n%i==0){
            res.push_back(P(i,1));
            n/=i;
            while(n%i==0){
                res.back().second++;
                n/=i;
            }
        }
    }
    if(n!=1) res.push_back(P(n,1));
    return res;
}

int main(){
  ll n,m; cin >> n >> m;
  vector<P> prime=primes(m);
  int pl=prime.size();
 
  mint ans=1;
  combination c(100100);
  rep(i,pl){
    ll now=prime[i].second;
    ans*=c(n+now-1,now);
  }
  

  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 4868
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
#define ll long long
#define fr(i,a,b) for (int i=a ; i<b ; i++)
#define fre(i,a,b) for (int i=a ; i<=b ; i++)
#define mem(a, b) memset(a, (b), sizeof(a))
#define mp make_pair
#define pb push_back
#define inf (int)1e9
#define pii 3.1415926535897932384626433832795
#define mod 1000000007
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pi> vii;
typedef map<int,int> mi;
typedef set<int> si;






int main() {
    FAST_IO;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    cin>>n;
    int w;
    cin>>w;
    long val[n+1];
    long wt[n+1];
    fr(i,0,n){
    	cin>>wt[i];
    	cin>>val[i];
    }
    ll dp[n+1][w+1];
    for(ll i=0;i<=n;i++){
    	for(ll j=0;j<=w;j++){
    		if(i==0 || j==0)
    			dp[i][j] = 0;
    	}
    }
    for(ll i=1;i<=n;i++){
    	for(ll j=1;j<=w;j++){
    		if(wt[i-1] <=j)
    			dp[i][j] = max(dp[i-1][j-wt[i-1]]+ val[i-1] , dp[i-1][j]);
    		else
    			dp[i][j] = dp[i-1][j];
    	}
    }
    cout<<dp[n][w]<<endl;
}

Measured memory_bytes: 82556
import bisect
import sys
input = sys.stdin.readline
a, b, q = map(int, input().split())
INF = 10 ** 18
s = [-INF] + [int(input()) for i in range(a)] + [INF]
t = [-INF] + [int(input()) for i in range(b)] + [INF]
ans = []
for i in range(q):
    x = int(input())
    idxs = bisect.bisect(s, x)
    idxt = bisect.bisect(t, x)
    ans.append(str(min(x - min(s[idxs - 1], t[idxt -1]),
                     x - s[idxs - 1] + (t[idxt] - s[idxs - 1]),
                     t[idxt] - x + (t[idxt] - s[idxs - 1]),
                     x - t[idxt - 1] + (s[idxs] - t[idxt - 1]),
                     s[idxs] - x + (s[idxs] - t[idxt - 1]),
                     max(s[idxs], t[idxt]) - x,
                     x - min(s[idxs - 1], t[idxt -1]))))
print('\n'.join(ans))


Measured memory_bytes: 21300
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<deque>
#include<iomanip>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
using namespace std;

#define pb push_back
#define mp make_pair

const double PI = acos(-1.0);
const double EPS = 1e-6;
const int INF = 0x3f3f3f3f;

const int MAXN = 200005;

int n, m;
int dp[200][200], dx[] = {0, -1}, dy[] = {-1, 0};

char maps[200][200];


int main() {

    cin >> n >> m;
    for (int i = 1; i <= n; ++i) for (int j = 1; j <= m; ++j) cin >> maps[i][j];

    for (int i = 0; i <= 100; ++i) dp[i][0] = dp[0][i] = INF;

    dp[0][1] = dp[1][0] = 0;
    for (int i = 1; i <= n; ++i) for (int j = 1; j <= m; ++j) {
        dp[i][j] = min(dp[i - 1][j] + ((maps[i][j] == '#') & (maps[i][j] != maps[i - 1][j])), dp[i][j - 1] + ((maps[i][j] == '#') & (maps[i][j] != maps[i][j - 1])));
    }
    /*
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) cout << dp[i][j] << " ";
        cout << endl;
    }
    */
    cout << dp[n][m] << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const double pi=acos(-1);

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

int main(){
    int x;
    cin >> x;
    int ans=0;
    while(ans*(ans+1)<2*x) ++ans;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define EPS (1e-10)
#define equal(x,y)  (fabs(x-y)<EPS)
enum Status{
	COUNTER_CLOCKWISE,CLOCKWISE,ONLINE_BACK,ONLINE_FRONT,ON_SEGMENT
};
struct Point{
	double x,y;
	Point(double _x,double _y): x(_x),y(_y){ }
	Point operator+(const Point & p){
		return Point(x+p.x,y+p.y);
	}
	Point operator-(const Point & p){
		return Point(x-p.x,y-p.y);
	}
	Point operator*(double k){
		return Point(k*x,k*y);
	}
};
typedef Point Vector;
double dot(const Vector &v1,const Vector & v2 ){
	return v1.x*v2.x+v1.y*v2.y;
}
double cross(const Vector &v1,const Vector & v2){
	return v1.x*v2.y-v1.y*v2.x;
}
double norm(const Vector & v){
	return dot(v,v);
}
double abs(const Vector & v){
	return sqrt(norm(v));
}
int ccw( Point &p1, Point & p2,  Point & p3){
	Vector v1=p2-p1,v2=p3-p1;
	if(cross(v1,v2)<-EPS) return CLOCKWISE;
	if(cross(v1,v2)>EPS) return COUNTER_CLOCKWISE;
	if(dot(v1,v2)<-EPS) return ONLINE_BACK;
	if(norm(v1)<norm(v2)) return ONLINE_FRONT;
	return ON_SEGMENT;
}
int main(){
	double x1,x2,y1,y2;
	int q;
	cin>>x1>>y1>>x2>>y2;
	cin>>q;
	Point p1(x1,y1),p2(x2,y2);
	for(int i=0;i<q;i++){
		cin>>x1>>y1;
		Point p3(x1,y1);
		switch(ccw(p1,p2,p3)){
			case COUNTER_CLOCKWISE:cout<<"COUNTER_CLOCKWISE"<<endl;break;
			case CLOCKWISE:cout<<"CLOCKWISE"<<endl;break;
			case ONLINE_FRONT:cout<<"ONLINE_FRONT"<<endl;break;
			case ONLINE_BACK:cout<<"ONLINE_BACK"<<endl;break;
			case ON_SEGMENT:cout<<"ON_SEGMENT"<<endl;break;
		}
	}
	return 0;
}


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

int main(){
  string N;
  cin>> N;
  int ans =0;
  if (N.at(0) == '7'){
    ans =1;
  }
  if (N.at(1) == '7'){
    ans =1;
  }
  if (N.at(2) == '7'){
    ans =1;
  }
  if (ans == 1){
    cout << "Yes"<<endl;
  }
  else{
    cout << "No"<<endl;
  }
  
    
  
  
  
}



Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
//int DP[1000005][2];
int main()
{
        int k,even=0,odd=0;
        cin>>k;
        if(k%2==0) {even=k/2;odd=k/2;}
        else {even=k/2;odd=k/2+1;}
        cout<<even*odd<<endl;
}

Measured memory_bytes: 256
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {

    public static String process(int N, List<Integer> H) {
        int max = H.get(0);
        int sum=0;
        for (int h:H){
            if (h>=max){
                sum++;
                max = Math.max(max, h);
            }
        }
        return String.valueOf(sum);
    }

    // Util func

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

        int N = sc.nextInt();
        List<Integer> H = IntStream.range(0, N).map(i->sc.nextInt()).boxed().collect(Collectors.toList());

        final String result = process(N, H);

        output(result);
    }

    private static void output(String result) {
        System.out.println(result);
    }
}


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

int main(void){
	int n;
	while(cin >> n){
		if(!n) break;
		int two=0,five=0;
		for(int i=2;i<=n;i++){
			int j = i;
			while(j%2==0||j%5==0){
				if(j%2==0){
					two++;
					j/=2;
				}
				if(j%5==0){
					five++;
					j/=5;
				}
			}
		}
		int count = min(two,five);
		cout << count << "\n";
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>                          
using namespace std;
int x,a,b,c,y,d,e,f,num1,num2;
int main(){
	cin>>x>>y>>a>>d;
	num1=abs(a-x);
	num2=abs(d-y);
	if(x<a)
	{
		if(y>d)
		{
			b=a+num2;
			e=d+num1;
			c=x+num2;
			f=y+num1;
		}
		if(y<d)
		{
			b=a-num2;
			e=d+num1;
			c=x-num2;
			f=y+num1;
		}
		if(y==d)
		{
			e=d+num1;
			b=a;
			f=y+num1;
			c=x;
		}
	}
	if(x>a)
	{
		if(y>d)
		{
			b=a+num2;
			e=d-num1;
			c=x+num2;
			f=y-num1;
		}
		if(y<d)
        {
        	b=a-num2;
        	e=d-num1;
        	c=x-num2;
        	f=y-num1;
		}
		if(y==d)
		{
			b=a;
			e=d-num1;
			c=x;
			f=y-num1;
		}
	}
	if(x==a)
	{
		if(y<d)
		{
			b=a-num2;
		    e=d;
		    c=x-num2;
		    f=y;
		}
		if(y>d)
		{
			b=a+num2;
			e=d;
			c=x+num2;
			f=y;
		}
	}
	cout<<b<<" "<<e<<" "<<c<<" "<<f;
	return 0;
}

Measured memory_bytes: 384
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

ll nl, nm;

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

  //int n, m;
  //string s;
  int a, b, c, x;
  cin >> a >> b >> c >> x;
  ll ans = 0LL;
  //set<int> s;
  REP(i, a+1) REP(j, b+1) REP(k, c+1) if(x == (i*500)+(j*100)+(k*50)) ans++;
  cout << ans << endl;
  //cout << s.size() << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <climits>
#include <cfloat>

using namespace std;

typedef pair<int, int> edge;

int main()
{
	while (true)
	{
		int n, m;
		scanf("%d", &n);
		if (n == 0)
			break;

		vector<edge> edges[100];
		bool inTree[100];
		fill(inTree, inTree+100, false);

		scanf("%d", &m);
		for (int i = 0; i < m; ++i)
		{
			int a, b, c;
			scanf("%d,%d,%d", &a, &b, &c);
			edges[a].push_back(edge(c, b));
			edges[b].push_back(edge(c, a));
		}

		int res = 0;

		priority_queue<int, vector<edge>, greater<edge> > q;
		inTree[0] = true;
		for (int i = 0; i < edges[0].size(); ++i)
			q.push(edges[0][i]);

		while (!q.empty())
		{
			edge e = q.top();
			q.pop();
			if (inTree[e.second])
				continue;

			inTree[e.second] = true;
			res += e.first / 100 - 1;
			for (int i = 0; i < edges[e.second].size(); ++i)
				q.push(edges[e.second][i]);
		}

		printf("%d\n", res);
	}

	return 0;
}

Measured memory_bytes: 0