akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()
 
#define REP(i,s,e)	for(int i=(s); i<(e); i++)
#define rep(i,n)	REP(i,0,n)
#define REPE(i,s,e)	for(int i=s; i>e; i--)
#define repe(i,n)	REPE(i,n,-1)


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
typedef vector<vi> vvi;
 
const int IMAX=((1<<30)-1)*2+1;
const int INF=100000000;
const double EPS=1e-10;
//int mod=1000000007




int main(){
	int n,m;
	char ope;
	cin>>n;
	while(cin>>ope>>m){
		if(cin.eof()){
			break;
		}
		if(ope == '+') n += m;
		else if(ope == '-') n -= m;
		else if(ope == '*') n *= m;
		else n /= m;
	}
	cout<<n<<endl;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b ;
  if(a==1&&b==2){
    cout << 3;
  }
  if(a==2&&b==1){
    cout << 3;
  }
  if(a==2&&b==3){
    cout << 1;
  }
  if(a==3&&b==2){
    cout << 1;
  }
  if(a==1&&b==3){
    cout << 2;
  }
  if(a==3&&b==1){
   cout << 2; 
  }
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define lp(i,n) for(int i=0;i<n;i++)
#include<bits/stdc++.h>


using namespace std;
int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (abs(c - a) <= d)
		cout << "Yes" << endl;
	else if (abs(b - a) <= d && abs(c - b) <= d)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast_input ios_base::sync_with_stdio(false);cin.tie(NULL);
typedef long long int ll;
int main()
{
    fast_input;
    int n;
    cin>>n;
    string s;
    cin>>s;
    int i;
    int cnt=0;
    int flag=0;
    for(i=0;i<n;i++){
        if(s[i]=='A')
          flag=1;
        else if(s[i]=='B'&&flag==1)
          flag=2;
        else if(s[i]=='C'&&flag==2){
          //cout<<i<<endl;
          cnt++;
          flag=0;
        }
        else
          flag=0;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 256
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool int_ceil(T a, T b) { T res = a / b; if(a % b != 0) res++; return res; }
template<typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define print(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define print(...)
#endif

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	int n;
	cin >> n;
	int ma = 0, ans = 0;
	rep(i, n){
		int h; cin >> h;
		if(ma <= h){
			ans++;
		}
		chmax(ma, h);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3556
public class Main {

  private static void solve() {
    int n = ni();

    for (int i = 1; i <= 9; i++) {
      for (int j = 1; j <= 9; j++) {
        if (i * j == n) {
          System.out.println("Yes");
          return;
        }
      }
    }
    System.out.println("No");
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}



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

int main(void){
    ll n;
    cin >> n;
    ll ans =0;
    if(n%2==1){
        ans = n*2;
    }
    else{
        ans = n;
    }
    cout << ans << endl;
    
    return 0;
}



















































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

using namespace std;

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    if (a <= 5) cout << 0 << endl;
    else if (a <= 12) cout << b / 2 << endl;
    else cout << b << endl;
    return 0;
}

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

#define rep(i,j,n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(), i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9 + 7;

typedef long long i64;
typedef pair<int, int> pi;

template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;

i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcd(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

template <class T> class BinaryIndexedTree {
  private:
    int n;
    std::vector<T> bit;

  public:
    BinaryIndexedTree(int node) : n(node), bit(node + 1, 0) {}

    inline T sum(int i) {
      ++i;
      T s = 0;
      while(i > 0) {
        s += bit[i];
        i -= i & -i;
      }
      return s;
    }

    inline T sum(int a, int b) {
      return sum(b) - sum(a - 1);
    }

    inline void add(int i, T x) {
      ++i;
      while(i <= n) {
        bit[i] += x;
        i += i & -i;
      }
    }

    int get(long long k) {
      ++k;
      int res = 0, N = 1;
      while(N < bit.size()) N *= 2;
      for(int i = N / 2; i > 0; i /= 2) {
        if(res + i < bit.size() && bit[res + i] < k) {
          k -= bit[res + i];
          res += i;
        }
      }
      return res + 1;
    }
};


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

  int n, q;
  cin >> n >> q;
  BinaryIndexedTree<int> bit(n);
  rep(i, 0, q) {
    int c, x, y;
    cin >> c >> x >> y;
    if(c == 0) bit.add(x - 1, y);
    else cout << bit.sum(x - 1, y - 1) << endl;
  }
}


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

const ll mod = 1000000007;
int main() {
    string S;
    cin >> S;
    int l = S.size();
    if(S.at(l-1) == 's'){
        cout << S << "es" << endl;
    }
    else{
        cout << S << "s" << endl;
    }
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
int main() {
  int n;cin >>n;pair<pair<string,int>,int> p[n];
  rep(i,n){
    string s;
    int k;
    cin >>s>>k;
    p[i] = make_pair(make_pair(s,-k),i+1);
  }
  sort(p,p+n);
  
  rep(i,n){
    cout<< p[i].second << endl;
  }
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

int main(void){
	ll a,b,c;
	cin >> a >> b >> c;
	ll ans = b + min(c, a + b + 1);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int N;
int64 a[105];

void Solve() {
    read(N);
    for(int i = 1 ; i <= N ; ++i) read(a[i]);
    int64 ans = 1e18;
    for(int64 i = -100 ; i <= 100 ; ++i) {
	int64 tmp = 0;
	for(int j = 1 ; j <= N ; ++j) {
	    tmp += (a[j] - i) * (a[j] - i);
	}
	ans = min(ans,tmp);
    }
    out(ans);enter;
}

int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
 
int main() {
  int N, M, L; cin >> N >> M >> L;
  long long matA[N][M], matB[M][L], matC[N][L];
  memset(matC, 0, sizeof matC);
  for(int i=0; i<N; i++)
    for(int j=0; j<M; j++)
      cin >> matA[i][j];
  for(int i=0; i<M; i++)
    for(int j=0; j<L; j++)
      cin >> matB[i][j];
  for(int i=0; i<N; i++)
    for(int j=0; j<M; j++)
      for(int k=0; k<L; k++)
        matC[i][k] += matA[i][j]*matB[j][k];
  for(int i=0; i<N; i++) {
    for(int j=0; j<L; j++) {
      if(j) cout << " ";
      cout << matC[i][j];
    }
    cout << endl;
  }
  return 0;
}


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

int main(void){
    string s;
    getline(cin,s);
    REP(i,s.size())
    {
        if(s[i]>='a'&&s[i]<='z')s[i]-=0x20;
        else if(s[i]>='A'&&s[i]<='Z')s[i]+=0x20;
    }
    cout<<s<<endl;
}


Measured memory_bytes: 3212
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <sstream>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define SZ(x) (int)(x.size())
#define F0(i,n) for(int i=0;i<n;i++)
#define F1(i,n) for(int i=1;i<=n;i++)
#define CL(a,x) memset(x, a, sizeof(x));
#define P(x) cerr << #x << "=" << x << endl

const int MOD = 1000002013;
const double pi = atan(1.0)*4.0;
const double eps = 1e-8;
ll gcd(ll x, ll y) { return y ? gcd(y, x%y) : x; }
int bc(int n) { return n ? bc((n-1)&n)+1 : 0; }

int i, j, k, m, n, l;


int main() {
   // freopen("x.in", "r", stdin);

    ll a, b, c, k;
    while (cin >> a >> b >> c >> k) {
        if (k % 2 == 0) cout << a - b << endl;
        else cout << b - a << endl;
    }
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;

namespace teisyutusensei
{
    class Program
    {
        static void Main(string[] args)
        {
            ////?????????????????????

            string dmmy = Console.ReadLine();

            int n = 200;

            string[] dmmySP = new string[n];

            char del = ' ';

            dmmySP = dmmy.Split(del);
            
            Stack stackBox = new Stack();

            int A = 0;
            int B = 0;
            int C = 0;

            for (int i = 0; i < dmmySP.Length; i++)
            {
                switch (dmmySP[i])
                {
                    case "+":
                        A = (int)stackBox.Pop();
                        B = (int)stackBox.Pop();
                        C = A + B;
                        stackBox.Push(C);
                        break;
                    case "-":
                        A = (int)stackBox.Pop();
                        B = (int)stackBox.Pop();
                        C = B - A;
                        stackBox.Push(C);
                        break;
                    case "*":
                        A = (int)stackBox.Pop();
                        B = (int)stackBox.Pop();
                        C = A * B;
                        stackBox.Push(C);
                        break;
                    default:
                        stackBox.Push(int.Parse(dmmySP[i]));
                        break;
                }
            }

            C = (int)stackBox.Pop();

            Console.WriteLine(C);
            Console.ReadLine();

        }
    }

}

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

int main() {
  // A: 500円玉の数
  // B: 100円玉の数
  // C: 50円玉の数
  // X: 支払いたい金額
  int A, B, C, X;
  int a, b, c;
  int sum, cnt = 0;
  
  cin >> A >> B >> C >> X;
  
  for(a = 0; a <= A; a++) {
    for(b = 0; b <= B; b++) {
      for(c = 0; c <= C; c++) {
        sum = 500 * a + 100 * b + 50 * c;

        if(sum == X) {
          cnt++;
        }
      }
    }
  }
  cout << cnt << endl;

}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;


public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final long X = sc.nextLong();
			
			long times = 0;
			for(long x = 100, time = 0; x < X; x += x / 100) {
				times++;
			}
			
			System.out.println(times);
			
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		

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

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}


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

int main(){
    string s,t;
    cin >> s >> t;
    for (int i = 0; i < s.size(); i++){
        if (i == s.size() - 1 && s.size() > t.size()){
            cout << s[i];
            break;
        }
        
        cout << s[i] << t[i];
    }
    cout << endl;
}

Measured memory_bytes: 256
nii=lambda:map(int,input().split())
from collections import deque

n,u,v=nii()
u-=1
v-=1

tree=[[] for i in range(n)]
for i in range(n-1):
  a,b=nii()
  a-=1
  b-=1
  tree[a].append(b)
  tree[b].append(a)

def BFS(s):
  dist=[-1 for i in range(n)]
  dist[s]=0

  que=deque()
  que.append(s)

  while que:
    x=que.popleft()
    for i in tree[x]:
      if dist[i]==-1:
        que.append(i)
        dist[i]=dist[x]+1
  return dist

dist_t=BFS(u)
dist_a=BFS(v)

ans=0
for i in range(n):
  if dist_a[i]>dist_t[i]:
    ans=max(ans,dist_a[i]-1)

print(ans)

Measured memory_bytes: 33776
fn main() {
    use proconio::input;

    input!(n: proconio::marker::Chars);
    let ds = n.iter().map(|c| c.to_digit(10).unwrap());
    let mut sum = 0;

    for d in ds {
        sum += d;
        sum %= 9;
    }
    if sum == 0 {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2972
#include<stdio.h>

int main(){
	long s;
	int i,d;
	while(scanf("%d",&d)!=EOF){
		i=1;s=0;
		while(i*d<600){
			s+=i*i*d*d*d;
			i++;
		}
		printf("%ld\n",s);
	}
	return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    ll D, X;
    cin >> N;
    cin >> D >> X;

    vector<ll> A(N);

    REP(i, N){
        cin >> A[i];
    }

    ll count = 0;
    REP(i, N){
        ll now = 1;
        while(now <= D){
            count++;
            now += A[i];
        }
    }
    cout << X + count << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
#include <functional>

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

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

int main()
{
	int N;
	cin>>N;
	ll aa=0;
	for(int i=0;i<N;i++)
	{
		ll a;
		cin>>a;
		aa+=a-1;
	}
	cout<<aa<<endl;
}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

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

  bool easy = true;
  for (int i = 0; i < s.size(); i += 2)
    if (s[i] == 'L') easy = false;
  for (int i = 1; i < s.size(); i += 2)
    if (s[i] == 'R') easy = false;

  cout << ((easy) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,k;
    cin>>n>>k;
    vector<int> heights(n);
    for(int &height:heights)
        cin>>height;
    int inf=1e9+7;
    vector<int> dp(n,inf);
    dp[n-1]=0;
    for(int i=n-1;i>=0;--i){
        for(int j=i+1;j<=i+k and j<n;++j){
            dp[i]=min(dp[i],dp[j]+abs(heights[i]-heights[j]));
        }
    }
    cout<<dp[0];
    cout<<endl;
}


Measured memory_bytes: 3968
#include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<vector>
    #include<algorithm>
    #include<stack>
    using namespace std;
    const int maxn = 1000000 + 10;
    #define INF 0x7fffffff
    #define clr(x,y) memset(x,y,sizeof(x))
    typedef long long ll;
    #define eps 10e-10
    const ll Mod = 1000000007;
    int a[100 + 10];
    int n;
    int calc(int x)
    {
        int ret = 0;
        for(int i = 1; i <= n; i ++)
            ret += (a[i] - x) * (a[i] - x);
        return ret;
    }
    int main()
    {
        while( ~ scanf("%d",&n))
        {
            for(int i = 1; i <= n; i ++)scanf("%d",&a[i]);
            int l = -100,r = 100;
            int ans = INF;
            for(int i = l; i <= r; i ++)
                ans = min(ans,calc(i));
            cout << ans << endl;
        }

        return 0;
    }


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

typedef struct{
  int parent;
  int left;
  int right;
}Node;

Node T[25];
int n;

void maigoCenter(void);
int findSibling(int);
int countDegree(int);
int findDepth(int);
int findHeight(int);
void printType(int);

int main(){
  int i, id;

  scanf("%d", &n);

  for(i=0; i<n; i++){
    scanf("%d", &id);
    scanf("%d%d", &T[id].left, &T[id].right);
    T[id].parent = -1;
  }

  maigoCenter();

  for(i=0; i<n; i++){
    printf("node %d: parent = %d, sibling = %d, ", i, T[i].parent, findSibling(i));
    printf("degree = %d, ", countDegree(i));
    printf("depth = %d, ", findDepth(i));
    printf("height = %d, ", findHeight(i));
    printType(i);
  }


  return 0;
}

void maigoCenter(void){
  int i;

  for(i=0; i<n; i++){
    if(T[i].left != -1){
      T[T[i].left].parent = i;
    }
    if(T[i].right != -1){
      T[T[i].right].parent = i;
    }
  }

} 

int findSibling(int n){
  if(T[n].parent != -1){
    if(T[T[n].parent].left == n){
      return T[T[n].parent].right;
    }else {
      return T[T[n].parent].left;
    }
  }
    return -1;
}

int countDegree(int n){
  int count = 0 ;

  if(T[n].left != -1) count++;
  if(T[n].right != -1) count++;

  return count;
}

int findDepth(int n){ 
  int i, parent;

  if(T[n].parent == -1) return 0;

  parent = T[n].parent;

  for( i = 1; T[parent].parent != -1; i++){
    parent = T[parent].parent;
  }

  return i;
}

int findHeight(int n){
  int left, right;

  if(T[n].left == -1 && T[n].right == -1) return 0;

  if( T[n].left == -1) {
    left = 0;
  }else {
    left = findHeight(T[n].left);
  }
  if( T[n].right == -1) {
    right = 0;
  }else {
    right = findHeight(T[n].right);
  }

  return (left > right ? left+1 : right+1);

}

void printType(int n){
  if(T[n].parent == -1) printf("root\n");
  else if(T[n].left == -1 && T[n].right == -1) printf("leaf\n");
  else printf("internal node\n");
}

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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

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

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

int n,k;
int B,C;
ll x[2][125252], y[2][125252];
ll xs[2][125252];
ll sz[125252];

int main(){
    cin>>n>>k;
    if(n<=100){
        // O(n^2 k)
        vi dp(n+1,1);
        dp[0] = 0;
        REP(_,k-1){
            vi ndp(n+1,0);
            REP(i,n+1)REP(j,n+1){
                if(i*j>n)continue;
                ndp[j] += dp[i];
                ndp[j] %= MOD;
            }
            ndp[0] = 0;
            dp = ndp;
        }
        ll ans = accumulate(ALL(dp),0ll);
        cout<<(ans%MOD)<<endl;
    }else{
        // O(sqrt(n) k)
        B = 1;
        while(B*B<=n)B++;
        C = n/(B+1);
        ll D = B+1;
        B *= 2;
        // B--;
        int cur = 0;
        fill(x[cur]+1, x[cur]+B+1, 1ll);
        fill(y[cur]+1, y[cur]+B+1, 1ll);
        REP(i,B+1)xs[cur][i+1] = (xs[cur][i] + x[cur][i]) % MOD;
        // FOR(i,1,B+1)printf("%lld, ",xs[cur][i]);puts("");
        FOR(i,1,B+1)sz[i] = (n/i) - (n/(i+1));
        k--;
        while(k--){
            int nxt = cur^1;
            fill(x[nxt]+1, x[nxt]+B+1, 0ll);
            fill(y[nxt]+1, y[nxt]+B+1, 0ll);
            fill(xs[nxt], xs[nxt]+B+2, 0ll);
            // ll acc = 0;
            FOR(i,1,B+1){
                y[nxt][i] = xs[cur][i+1];
                // (acc += x[cur][i]) %= MOD;
                // y[nxt][i] = acc;
            }
            ll sum = 0;
            FOR(i,1,C)(sum += y[cur][i]*sz[i]%MOD)%=MOD;
            FOR(i,1,D+1)(sum += x[cur][i])%=MOD;
            FOR(i,1,B+1){
                if(n/i<=B){
                    x[nxt][i] = xs[cur][n/i+1];
                }else{
                    x[nxt][i] = sum;
                    sum = (sum-y[cur][i]*sz[i]%MOD+MOD)%MOD;
                }
            }
            cur = nxt;
            REP(i,B+1)xs[cur][i+1] = (xs[cur][i] + x[cur][i]) % MOD;
        }
        // DEBUG(C); DEBUG(D);
        // FOR(i,1,B+1)printf("%lld, ",x[cur][i]);puts("");
        // FOR(i,1,B+1)printf("%lld, ",xs[cur][i]);puts("");
        // FOR(i,1,B+1)printf("%lld, ",y[cur][i]);puts("");
        // FOR(i,1,B+1)printf("%lld, ",sz[i]);puts("");
        ll sum = 0;
        FOR(i,1,C)(sum += y[cur][i]*sz[i]%MOD)%=MOD;
        FOR(i,1,D+1)(sum += x[cur][i])%=MOD;
        cout<<sum<<endl;
    }
    return 0;
}


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

using namespace std;

int main() {
    vector<int> dish;
    vector<int> amari;
    int tmp;
    while (cin >> tmp) dish.push_back(tmp);
    for (auto itr = dish.begin(); itr != dish.end(); itr++) {
        amari.push_back(*itr % 10);
        //cout << "amari" << *itr  % 10<< endl;
    }
    int index = 0;
    for (int i = 0; i < amari.size(); i++) {
        if (amari[i] >= 1 && amari[index] > amari[i]) {
            index = i;
        }
    }
    int ans = 0;
    for (int i = 0; i < (int) dish.size(); i++) {
        if (i != index) {
            if (dish[i] % 10 == 0) {
                ans += dish[i];
                continue;
            }
            ans += dish[i] + abs(dish[i] % 10 - 10);
        }
    }
    ans += dish[index];
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <queue>
#include <sstream>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()
#define AALL(a, n) (a), a + n
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)

using namespace std;

typedef long long ll;

const double EPS = 1e-10;
const double PI = acos(-1.0);

inline int toInt(string s) {
	int v;
	istringstream sin(s);
	sin >> v;
	return v;
}

int main() {
	int a;
	char s[11];

	scanf("%d", &a);
	scanf("%s", s);
	puts(a < 3200 ? "red" : s);
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	String S = sc.next();
    	String T = sc.next();
    	sc.close();
    	System.out.println(T.startsWith(S)?"Yes":"No");
    }
}

Measured memory_bytes: 35688
#include<bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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 dh[4] = {-1, 0, 0, 1};
int dw[4] = {0, -1, 1, 0}; 
using P = pair<int, int>;
const double pi = acos(-1.0);

using Graph = vector<vector<ll>>;


ll prime[10000000];
vector<bool> is_prime;

vector<bool> seive(ll n){
  ll  p=0;
  rep(i,n+1)is_prime[i]=true;
  is_prime[0]=is_prime[1]=false;
  Rep(i,2,n+1){
    if(is_prime[i]){
      prime[p++]=i;
      for(ll j=2*i;j<=n;j+=i)is_prime[j]=false;
    }
  }
  return is_prime;
}

int main(){
  ll q;
  cin>>q;
  vector<bool>isp;

  is_prime.resize(100002);
  isp=seive(100002);
  vector<ll>cnt(100002);
  rep(i,100002){
    if(isp[i]&&isp[(i+1)/2])cnt[i]+=cnt[i-1]+1;
    else cnt[i]=cnt[i-1];
  }

  
  ll l,r;
  rep(i,q){
    cin>>l>>r;
    ll ans=cnt[r]-cnt[l-1];
    cout<<ans<<endl;
    
  }
    
    
  return 0;
}


Measured memory_bytes: 4044
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1;i<(int)(n);i++)
#define ll long long
#define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001
int gcd(int a, int b){
    if(a%b == 0){
        return b;
    }else{
    return gcd(b, a%b);
    }
}

int main(){
    string a,b;
    cin >> a >> b;
    int sum=0;
    istringstream ss= istringstream(a+b);
    ss >> sum;
    rep(i,sum/2){
        if(i*i==sum){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;    
}

Measured memory_bytes: 3576
/*
    ????????°??§???????????¨????????????
*/

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#include <float.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iterator>
#include <vector>
#include <map>
#include <utility>
#define LLU unsigned long long int
#define LL long long int
#define LD long double
using namespace std;
#define Lfmax DBL_MAX
#define LLUmax ULLONG_MAX
#define LLmax LLONG_MAX
#define dmax INT_MAX
#define vd vector<int>
#define vLL vector<long long int>
#define vLLU vector<unsigned long long int> 
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define debug printf("asd\n")
#define debugd(a) printf("--%d\n",a)
#define debugdd(a,b) printf("--%d %d\n",a,b)
#define debugarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i]);printf("\n")
#define newline printf("\n")
#define forin(a,b,c) for(int a=b ; a<c ; a++)
#define forde(a,b,c) for(int a=b ; a<c ; a--)


inline void scd(int &a){scanf("%d",&a);}
inline void scdd(int &a,int &b){scanf("%d %d",&a,&b);}
inline void sctd(int &a,int &b,int &c){scanf("%d %d %d",&a,&b,&c);}
inline void scdlld(long int &a,long int &b){scanf("%I64d %I64d",&a,&b);}
inline void sclld(long long int &a){scanf("%I64d",&a);}

#define scarrd(a,b) for(int index=0 ; index<b ; index++)scanf("%d",&a[index])
#define prdlld(a,b) printf("%I64d %I64d",a,b)
#define prdd(a,b) printf("%d %d",a,b)
#define prd(a) printf("%d",a)
#define prarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i])
#define iniarr(a,b) for(int i=0 ; i<b ;i++)a[i]=0
#define arr(a,b) int *a=(int *)malloc(b*sizeof(int))
#define llarr(a,b) long long int *a=(long long int *)malloc(b*sizeof(long long int))
#define st(a,b) char *a=(char *)malloc(b*sizeof(char))
#define grav 9.8
#define pi 3.14159265

int main()
{
	float n;
	while(scanf("%f",&n)!=EOF)
	{
		int d=0;
		for(int i=0 ; i<=9 ; i++)
		{
			for(int j=0 ; j<=9 ; j++)
			{
				for(int k=0 ; k<=9 ; k++)
				{
					for(int l=0 ; l<=9 ; l++)
					{
						int x=i+j+k+l;
						//printf("--%d %d %d %d == %d\n",i,j,k,l,x);
						if(x==n)
						{
							//printf("%d %d %d %d\n",i,j,k,l);
							d++;
							break;
						}
						
					}
				}
			}
		}
		printf("%d\n",d);
	}
	return 0;
}

Measured memory_bytes: 3224
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <functional>
#include <queue>
#include <map>
#include <set>
#include <string>
#define INF 1000000000LL

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

int main()
{
	ll X;
	scanf("%lld",&X);
	ll L=0,R=INF;
	while(R-L>1)
	{
		ll m=(L+R)/2;
		if(m*(m+1)/2LL>=X) R=m;
		else L=m;
	}
	printf("%lld\n",R);
	return 0;
}


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

using namespace std;

int w, h;
int graph[50][50];
int dx[] = {-1, 0, 1, 1, 1, 0, -1, -1};
int dy[] = {-1, -1, -1, 0, 1, 1, 1, 0};

void solve(int y, int x) {
    graph[y][x] = 0;
    for(int i = 0; i < 8; ++i) {
        int ny = y + dy[i];
        int nx = x + dx[i];
        if(ny >= 0 && ny < h && nx >= 0 && nx < w && graph[ny][nx]) {
            solve(ny, nx);
        }
    }
}

int main() {

    while(cin >> w >> h, w | h) {

        int cnt = 0;

        for(int i = 0; i < h; ++i) {
            for(int j = 0; j < w; ++j) {
                cin >> graph[i][j];
            }
        }

        for(int i = 0; i < h; ++i) {
            for(int j = 0; j < w; ++j) {
                if(graph[i][j]) {
                    solve(i, j);
                    ++cnt;
                }
            }
        }

        cout << cnt << endl;

    }

}

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

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)

const int INF = 1e9;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

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


int main(void){
  ios::sync_with_stdio(false);


  int r;
  cin >> r;
  int ans = r * r;
  cout << ans << endl;


  return 0;
}



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

int main(){
  int w,h,a,b;
  cin >> w >> h >> a >> b;
  double ans=(double)w*(double)h/2.0;
  bool flag=false;
  if(2*a==w&&2*b==h) flag=true;
  cout << ans << " " << (flag?1:0) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef complex<double> P;
 
const double eps = 1e-10;
 
bool equals(double a, double b, double eps = 1e-10) {
  return abs(a-b) < eps;
}
 
double dot(P a, P b) {
  return a.real()*b.real() + a.imag()*b.imag();
}
 
double cross(P a, P b) {
  return a.real()*b.imag() - a.imag()*b.real();
}
 
int ccw(P p, P a, P b) {
  a -= p;
  b -= p;
  if(cross(a,b) > eps) return 1;
  if(cross(a,b) < -eps) return -1;
  if(dot(a,b) < -eps) return 2;
  if(norm(b)-norm(a) > eps) return -2;
  return 0;
}
 
P getCrossP(P a1, P a2, P b1, P b2) {
  P a = a2 - a1;
  P b = b2 - b1;
  return a1 + a * cross(b, b1 - a1)/cross(b, a);
}
 
double getArea(const vector<P> &ps) {
  int n = ps.size();
  double res = 0;
  for(int i = 0; i < ps.size(); ++i) {
    res += cross(ps[i], ps[(i+1)%n]);
  }
  return res / 2.0;
}
 
vector<P> convex_cut(vector<P> ps, P p1, P p2, int dir = -1) {
  vector<P> v;
  for(int i = 0; i < ps.size(); ++i) {
    P a = ps[i];
    P b = ps[(i+1)%ps.size()];
    if(ccw(p1, p2, a) != dir) v.push_back(a);
    if(ccw(p1, p2, a)*ccw(p1, p2, b) == -1)
      v.push_back(getCrossP(a, b, p1, p2));
  }
  return v;
}
 
int main() {
  int N; cin >> N;
  vector<P> ps(N);
  for(int i = 0; i < N; ++i) {
    cin >> ps[i].real() >> ps[i].imag();
  }
  if(getArea(ps) < 0) reverse(ps.begin(), ps.end());
  double S = getArea(ps);
  double x = 0, y = 0;
  for(int i = 0; i < N; ++i) {
    x += ps[i].real();
    y += ps[i].imag();
  }
  x /= N;
  y /= N;
  P g(x, y);
  bool flag = true;
  srand(time(NULL));
  for(int k = 0; k < 100000; ++k) {
    double rad = (double)rand()/(double)RAND_MAX * (double)M_PI;
    P t = g + P(cos(rad), sin(rad));
    if(!equals(getArea(convex_cut(ps, g, t)), S/2.0, 1e-2)) {
      flag = false;
      break;
    }
  }
  if(flag) {
    printf("%.10f %.10f\n", g.real(), g.imag());
  } else {
    printf("NA\n");
  }
  return 0;
}

Measured memory_bytes: 1264
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <queue>


using namespace std;

int main() {
    long long int N, *A, *B, ans = 0, M;
    cin >> N;
    
    A = new long long int[N +1];
    B = new long long int[N];

    for (int i = 0; i < N + 1; i++) {
        cin >> A[i];
    }

    for (int i = 0; i < N; i++) {
        cin >> B[i];
    }


    M = A[N];

    for (int i = N - 1; 0 <= i; i--) {
        M += A[i];
        if (B[i] >= M) {
            ans += M;
            M = 0;
        }
        else {
            ans += B[i];
            M = min(A[i], M - B[i]);
        }
    }

    cout << ans;

    return 0;

}



Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
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) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

void solve()
{
    ll n; cin >> n;
    ll ans = 0;
    ans += 1000LL * (n / 500LL);
    n %= 500LL;
    ans += 5LL * (n / 5LL);
    cout << ans << endl;
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[][] intTouA=new int[3][10];
        int[][] intTouB=new int[3][10];
        int[][] intTouC=new int[3][10];
        int[][] intTouD=new int[3][10];
        for(int i=0; i<3;i++){
            for(int j=0; j<10;j++){
            intTouA[i][j]=0;
            intTouB[i][j]=0;
            intTouC[i][j]=0;
            intTouD[i][j]=0;
            }
        }
        int a=scanner.nextInt();
        for(int i=0; i<a;i++){
            int tou=scanner.nextInt();
            int kai=scanner.nextInt();
            int ban=scanner.nextInt();
            int ninzu=scanner.nextInt();
            
            if(tou==1){
                intTouA[(kai-1)][(ban-1)]+=ninzu;
            }
            if(tou==2){
                intTouB[(kai-1)][(ban-1)]+=ninzu;
            }
            if(tou==3){
                intTouC[(kai-1)][(ban-1)]+=ninzu;
            }
            if(tou==4){
                intTouD[(kai-1)][(ban-1)]+=ninzu;
            }
        }
        
        for(int i=0; i<3;i++){
            for(int j=0; j<10;j++){
                System.out.print(" "+intTouA[i][j]);
            }
            System.out.println("");
        }
        System.out.println("####################");
        for(int i=0; i<3;i++){
            for(int j=0; j<10;j++){
                System.out.print(" "+intTouB[i][j]);
            }
            System.out.println("");
        }
        System.out.println("####################");
        for(int i=0; i<3;i++){
            for(int j=0; j<10;j++){
                System.out.print(" "+intTouC[i][j]);
            }
            System.out.println("");
        }
        System.out.println("####################");
        for(int i=0; i<3;i++){
            for(int j=0; j<10;j++){
                System.out.print(" "+intTouD[i][j]);
            }
            System.out.println("");
        }
    }
}

Measured memory_bytes: 29404
#include<stdio.h>

int main(void)
{
        int i,n=0;
        char s[100000];

        scanf("%s",s);

        while(s[n]!='\0'){
                n++;
        }

        for(i=0;i<n;i=i+2){
                printf("%c",s[i]);
        }
        printf("\n");

        return 0;
}


Measured memory_bytes: 256
///I am Groot |*|
///19.09.2020>>03.07 PM
#include <iostream>
using namespace std;

int main()
{
    long long int n,x,sum=0,i;
    cin>>n;
    x=n;
    for(i=0; ; i++)
    {

        if(n>9)
        {
            sum=sum+n%10;
            n=n/10;
        }
        else
        {
            break;
        }

    }
    sum=sum+n;
    if(x%sum==0)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int x,n,i,j,f,b;
  cin >> x >> n;
  
  int ar[n];
  set <int> s;
  for(i=0;i<n;i++)
  {
    cin >> ar[i];
    s.insert(ar[i]);
  }
  
  for(i=x;i<=1000;i++)
  {
    if(s.find(i)==s.end())
    {
    f=i;
    break;
    }
  }
  
  for(j=x;j>=-1000;j--)
  {
    if(s.find(j)==s.end())
    {
    b=j;
    break;
    }
  }
  
  if(abs(x-b)<=abs(x-f))
    cout << b;
  else
    cout << f;
}

Measured memory_bytes: 3616
import sys
sys.setrecursionlimit(100000000)

class UnionFind():
    def __init__(self,size):
        self.table = [-1 for _ in range(size)]
    def find(self,x):
        if self.table[x] < 0:
            return x
        else:
            self.table[x] = self.find(self.table[x])
            return self.table[x]
    def union(self,a,b):
        a1 = self.find(a)
        a2 = self.find(b)
        if a1!= a2:
            if self.table[a1] < self.table[a2]:
                self.table[a1] = a2
            elif self.table[a2] < self.table[a1]:
                self.table[a2] = a1
            else:
                self.table[a1] = a2
                self.table[a2] -= 1
        return
N, M =map(int,input().split())
uf = UnionFind(N)
for _ in range(M):
    x,y,z = map(int,input().split())
    uf.union(x-1,y-1)
cnt = 0
for i in range(N):
    if uf.table[i] < 0:
        cnt += 1
print(cnt)

Measured memory_bytes: 6764
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
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;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int x, y, a, b, c; cin >> x >> y >> a >> b >> c;
  vector<ll> P(a), Q(b), R(c);
  rep(i, a) cin >> P[i];
  rep(i, b) cin >> Q[i];
  rep(i, c) cin >> R[i];
  sort(all(P), greater<ll>());
  sort(all(Q), greater<ll>());
  priority_queue<ll> q;
  rep(i, min(a, x)) q.push(P[i]);
  rep(i, min(b, y)) q.push(Q[i]);
  rep(i, c) q.push(R[i]);
  ll ans = 0;
  rep(i, x+y) ans += q.top(), q.pop();
  cout << ans << endk;
  return 0;
}


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

void solve(long long A, long long B) {
    cout << (A+B)%24 << endl;
}

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

  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  solve(A, B);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define endl "\n"
#define INT long long int
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    INT m=0,i,n,a, s=0;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> a;
        if(m<a){
            m=a;
        }else{
            s = s+m-a;
        }
    }
    cout << s<<endl;
}


Measured memory_bytes: 3612
# https://abc052.contest.atcoder.jp/tasks/arc067_a
import collections
import math
import sys

BIGINT = 1000000007
N = int(input())
counts = collections.defaultdict(int)

for n in range(2, N+1):
    for d in range(2, int(math.sqrt(n)) + 1):
        while n % d == 0:
            n = n // d
            counts[d] += 1
    if n > 1:
        counts[n] += 1

# print("counts:", counts, file=sys.stderr)

res = 1
for v in counts.values():
    res = (res * (v + 1) % BIGINT)

print(res)


Measured memory_bytes: 3572