akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ms(x, t) memset(x, t, sizeof(x))
#define ff first
#define ss second
#define all(ar) ar.begin(), ar.end()
#define rall(ar) ar.rbegin(), ar.rend()
#define endl "\n"
typedef pair<int, int> pll;
typedef pair<int, pll> plll;
typedef vector<int> vl;
typedef vector<vector<int>> vvl;
typedef vector<pll> vpll;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
  cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
  const char *comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}

const int limit = 1e5 + 1;
const int inf = 1e7;
const int mod = 2019;

int modExpItr(int a, int b) {
  int ans = 1;
  while (b > 0) {
    if (b & 1) {
      ans = (ans * a) % mod;
    }
    a = (a * a) % mod;
    b = b >> 1;
  }
  return ans;
}

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  int n = s.size();
  map<int, int> mp;
  mp[0] = 1;
  int val = 0;
  for (int i = n - 1; i >= 0; i--) {
    val = val + ((s[i] - '0') * modExpItr(10, n - i - 1)) % mod;
    val %= 2019;
    mp[val]++;
  }
  int sum = 0;

  for (auto x : mp) {
    sum += x.ss * (x.ss - 1) / 2;
  }
  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 3772
/* monkukui 競技プログラミング用のテンプレート  (ここから) */
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
using ll = long long int;
using lnt = long long int;
using Graph = vector<vector<int>>;
using Wgraph = vector<vector<pair<int, long long int>>>;
constexpr long long int INF = 1001001001001001LL;
constexpr long long int MOD = 1000000007LL;
constexpr double PI = 3.1415926535897932;
constexpr long long int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
constexpr long long int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

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;}
inline void yes(){ cout << "yes" << endl; }
inline void Yes(){ cout << "Yes" << endl; }
inline void YES(){ cout << "YES" << endl; }
inline void no(){ cout << "no" << endl; }
inline void No(){ cout << "No" << endl; }
inline void NO(){ cout << "NO" << endl; }
inline void possible(){ cout << "possible" << endl; }
inline void Possible(){ cout << "Possible" << endl; }
inline void POSSIBLE(){ cout << "POSSIBLE" << endl; }
inline void impossible(){ cout << "impossible" << endl; }
inline void Impossible(){ cout << "Impossible" << endl; }
inline void IMPOSSIBLE(){ cout << "IMPOSSIBLE" << endl; }

#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = 1; i <= (n); i++)
#define DREP(i,n) for(int i = (n)-1; i >= 0; i--)
#define SREP(i,s,t) for(int i = s; i < t; i++)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define PB push_back

/* monkukui 競技プログラミング用のテンプレート (ここまで)*/

int main(){
  
  int h, w, k; cin >> h >> w >> k;
  vector<vector<int>> g(h, vector<int> (w, 0));
  vector<int> cnt(h, 0);
  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++) {
      char c; cin >> c;
      if(c == '#') { 
        g[i][j] = 1;
        cnt[i]++;
      }
    }
  }

  
  int color = 1;
  vector<vector<int>> ans(h, vector<int> (w, -1));

  for(int i = 0; i < h; i++) {
    int j = 0;
    if(cnt[i] == 0) {
      continue;
    }

    while(cnt[i] > 1) {
      // イチゴが出てくるまで塗る
      while(1) {
        ans[i][j] = color;
        if(g[i][j] == 1) break;
        j++;
      }

      cnt[i]--;
      color++;
      j++;
    }

    // 残り全部塗る
    for(; j < w; j++) {
      ans[i][j] = color;
    }
    
    color++;
  }

  for(int i = 0; i < h - 1; i++) {
    for(int j = 0; j < w; j++) {
      if(ans[i + 1][j] == -1) ans[i + 1][j] = ans[i][j];
    }
  }

  for(int i = h; i > 0; i--) {
    for(int j = 0; j < w; j++) {
      if(ans[i - 1][j] == -1) ans[i - 1][j] = ans[i][j];
    }
  }

  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++) {
      if(j == w - 1) cout << ans[i][j] << endl;
      else cout << ans[i][j] << " ";
    }
  }

  return 0;
}


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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a + b + c >= 22) {
    cout << "bust" << endl;
  }
  else {
    cout << "win" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define popcnt(a) __builtin_popcount(a)
#define FastIO() ios::sync_with_stdio(false), cin.tie(0);
#define IO() freopen("palindrome.in","rw",stdin)
#define error(args...)                       \
{                                            \
    cerr<<"LINE "<<__LINE__;                 \
    string _s = #args;                       \
    replace(_s.begin(), _s.end(), ',', ' '); \
    stringstream _ss(_s);                    \
    istream_iterator<string> _it(_ss);       \
    err(_it, args);                          \
    cerr<<endl;                              \
}
void err(istream_iterator<string> it)
{
} 
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
  cerr<<' '<< *it << " = " << a ;
  err(++it, args...);
} 
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 1e6+9, M = (1<<31), OO = 0x3f3f3f3f;

int main()
{
  int x,y;
  scanf("%d%d",&x,&y);
  if(x<y) printf("0");
  else printf("10");
  #ifdef _LOCAL_DEFINE
  cerr << (double)clock() * 1.0 / CLOCKS_PER_SEC << endl;
  #endif
  return 0; 
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
#define ll long long
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define clr(x,y) memset(x,y,sizeof(x))
#define in(a) a=read()
#define out(a) printf("%d\n",a)
inline ll read(){
	char c=getchar();ll f=1,x=0;
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9')x=x*10+(c-'0'),c=getchar();
	return x*f;
}
#define mod 1000000007
#define maxn 100010
#define inf (1<<30)
char s[maxn];
int main(){
	int n;
	in(n);
	if(n==3||n==5||n==7)puts("YES");
	 else puts("NO");
}
//5*5*3


Measured memory_bytes: 256
#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 int dx[4] = {1, 0, 0, -1};
const int dy[4] = {0, 1, -1, 0};

int main() {
  ll h, w;
  cin >> h >> w;
  vector<string> s(h);
  rep(i, h) cin >> s[i];

  rep(i, h) rep(j, w) {
    if (s[i][j] == '#') {
      bool flag = false;
      rep(k, 4) {
        ll nx = i + dx[k], ny = j + dy[k];
        if (0 <= nx && nx < h && 0 <= ny && ny < w && s[nx][ny] == '#')
          flag = true;
      }
      if (!flag) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
/*
struct Edge
{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
*/
using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

bool isPrime(long long num)
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false;

    double sqrtNum = sqrt(num);

    for (int i = 3; i <= (int)sqrtNum; i++)
    {
        if (num % i == 0)
            return false;
    }

    return true;
}

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

    vector<int> res(100010);
    for (int i = 1; i <= 100000; i++)
    {
        if (i % 2 == 0)
            continue;
        if (isPrime(i) && isPrime((i + 1) / 2))
            res[i]++;
    }

    vector<int> sum(100011);
    for (int i = 0; i < 100010; i++)
    {
        sum[i + 1] = sum[i] + res[i];
    }

    for (int i = 0; i < Q; i++)
    {
        int l, r;
        cin >> l >> r;
        cout << sum[r + 1] - sum[l] << endl;
    }
    return 0;
}


Measured memory_bytes: 3892
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        

fast();

{
    ll n,m,f=0;
    cin>>n>>m;
    vector<ll>adj[200005];
    for(int i=0;i<m;i++)
    {
      ll x,y;
      cin>>x>>y;
      adj[x].pb(y);
    }
    /*for(int i=1;i<=m;i++)
    {
      for(auto t:adj[i])
        cout<<t<<" ";
      cout<<endl;
    }*/
    //cout<<"size = "<<adj[1].size()<<endl;
    for(int i=0;i<adj[1].size();i++)
    {
      ll temp=adj[1][i];
       //cerr<<"temp = "<<temp<<endl;
       //cerr<<"here = "<<adj[temp].size()<<endl;
        if(adj[temp].size()>0)
         {
          //cout<<"Hello"<<endl;
          for(auto t:adj[temp])
           {
             if(t==n)
             {
               
               f=1;
               break;
              }
           }
         }
    
    }
    if(f)
    {
      cout<<"POSSIBLE"<<endl;
    }
    else
    {
      cout<<"IMPOSSIBLE"<<endl;
    }

}
return 0;
}

Measured memory_bytes: 8960
package main

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

// input scanner
var sc = bufio.NewScanner(os.Stdin)

const (
	initialBufSize = 10e4
	maxBufSize     = 10e6
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

// util
func max(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n > ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

func min(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n < ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

func pad(a int) string {
	s := strconv.Itoa(a)
	if len(s) == 5 {
		return "0" + s
	}
	if len(s) == 4 {
		return "00" + s
	}
	if len(s) == 3 {
		return "000" + s
	}
	if len(s) == 2 {
		return "0000" + s
	}
	if len(s) == 1 {
		return "00000" + s
	}
	return s
}

// main
func main() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	n := nextInt()
	m := nextInt()
	d := make(map[int]int, m)
	a := make([]int, m)
	for i := 0; i < m; i++ {
		p := nextInt()
		y := nextInt()
		d[y] = p
		a[i] = y
	}
	sorted := make([]int, m)
	copy(sorted, a)
	sort.Ints(sorted)
	c := make([]int, n)
	ans := make(map[int]int, m)
	for i := 0; i < m; i++ {
		c[d[sorted[i]]-1]++
		ans[sorted[i]] = c[d[sorted[i]]-1]
	}
	for i := 0; i < m; i++ {
		fmt.Println(pad(d[a[i]]) + pad(ans[a[i]]))
	}
}


Measured memory_bytes: 14720
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
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; }
struct io { io() { ios::sync_with_stdio(false); cin.tie(0); } };
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void)
{    
    ll n, m;
    cin >> n >> m;
    ll time = 1900*m + 100*(n-m);
    
    
    
    mes(time * pow(2, m));
	
    
    
    
    
    
}

Measured memory_bytes: 4280
import java.util.Scanner;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		Scanner sc=new Scanner(System.in);
		int prayer= sc.nextInt();
		int[][] point=new int[prayer][3];
		int print[]=new int[prayer];
		
		for(int i=0;i<prayer;i++){
			int point0=sc.nextInt();
			int point1=sc.nextInt();
			int point2=sc.nextInt();	
			point[i][0]=point0;
			point[i][1]=point1;
			point[i][2]=point2;		
		}
		for(int h=0;h<3;h++){
			for(int i=0;i<prayer;i++){
				int z=point[i][h];
				for(int j=0;j<prayer;j++){	
					if(z==point[j][h]&&(i!=j)){
						point[j][h]=0;
						point[i][h]=0;
					}
				}
			}
		}
			for(int j=0;j<prayer;j++){
				int result=0;
				for(int i=0;i<3;i++){
					result=result+point[j][i];
					print[j]=result;		
				}
			}
			for(int i=0;i<prayer;i++){
				System.out.println(print[i]);	
		}
	}
}

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

int main()
{
ll n ;
cin >> n ;
vector<ll> a(n);
rep(i, n){
  cin >> a[i];
}
ll b=1;
rep(i,n){
  if(a[i]==b)b++;
}
if(b==1) cout << -1 << endl;

else cout << n-b+1 << endl;
return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

int main(){
	int a, b; std::cin >> a >> b;
	for(int i = 1; i < 10001; ++i){
		int A = i * 8 / 100;
		int B = i * 10 / 100;
		if (a == A && b == B) {
			std::cout << i << std::endl;
			return 0;
		}
	}
	std::cout << -1 << std::endl;
	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1001001001
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef vector<vector<ll>> Matrix;

int n, m;
vector<int> a, b, c;
Matrix dp;

void input() {
  cin >> n >> m;
  a = b = c = vector<int>(m);
  rep(i, m) {
    cin >> a[i] >> b[i];
    rep(j, b[i]) {
      int c_;
      cin >> c_;
      c[i] += 1 << --c_;
    }
  }
}

int main() {
  input();
  int sn = pow(2, n);
  dp = Matrix(m+1, vector<ll>(sn, INF));
  rep(i, m+1) dp[i][0] = 0;
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j < sn; j++) {
      dp[i][j] = min(dp[i-1][j], dp[i-1][(j & (~c[i-1]))] + a[i-1]);
    }
  }
  if (dp[m][sn-1] == INF) cout << -1 << endl;
  else cout << dp[m][sn-1] << endl;
}


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

const long long INF = 1LL<<60;

int main() {
    int N, W;
    cin >> N >> W;
    int weight[110], value[110];
    for (int i = 0; i < N; i++) cin >> weight[i] >> value[i];

    long long dp[110][100100];
    for (int i = 0; i < 110; i++) {
        for (int j = 0; j < 100100; j++) {
            dp[i][j] = INF;
        }
    }

    dp[0][0] = 0;
    for (int i = 0; i < N; i++) {
        for (int sum_v = 0; sum_v < 100100; sum_v++) {
            if (sum_v >= value[i]) dp[i + 1][sum_v] = min(dp[i + 1][sum_v], dp[i][sum_v - value[i]] + weight[i]);
            dp[i + 1][sum_v] = min(dp[i + 1][sum_v], dp[i][sum_v]);
        }
    }

    long long res = 0;
    for (int sum_v = 0; sum_v < 100100; sum_v++) {
        if (dp[N][sum_v] <= W) res = sum_v;
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 86272
use std::io::BufRead;
pub struct Bill {
    pub floars: Vec<Floar>,
}
pub struct Floar {
    pub rooms: Vec<Room>,
}
pub struct Room {
    pub people: isize,
}
impl Bill {
    pub fn new() -> Bill {
        let mut bill = Bill { floars: Vec::new() };
        for _ in 0..3 {
            bill.floars.push(Floar::new());
        }
        bill
    }
}
impl Floar {
    pub fn new() -> Floar {
        let mut floar = Floar { rooms: Vec::new() };
        for _ in 0..10 {
            floar.rooms.push(Room::new());
        }
        floar
    }
}
impl Room {
    pub fn new() -> Room {
        Room { people: 0 }
    }
    pub fn add_people(&mut self, num: isize) {
        self.people += num;
        if self.people < 0 {
            self.people = 0;
        } else if self.people > 9 {
            self.people = 9;
        }
    }
}
pub fn print_bills(bills: &[Bill]) {
    let mut s = String::new();
    for bill in bills {
        for floar in &bill.floars {
            for room in &floar.rooms {
                s.push_str(&format!(" {}", room.people));
            }
            s.push_str("\n");
        }
        s.push_str("####################\n");
    }
    let s_len = s.len(); 
    s.split_off(s_len - 21);
    print!("{}", s);
}

use std::mem;
fn main() {
    let mut buffer = String::new();
    let stdin = std::io::stdin();
    let mut handle = stdin.lock();
    handle.read_line(&mut buffer).ok();

    let length: u32 = buffer.trim().parse().ok().unwrap();
    let mut bills = Vec::new();
    for _ in 0..4{
        bills.push(Bill::new());
    }
    for _ in 0..length {
        let mut info = String::new();
        let mut isize_info_vec;
        handle.read_line(&mut info).ok();
        isize_info_vec = info.trim().split_whitespace()
        .map(|i| i.parse().ok().unwrap()).collect::<Vec<isize>>();
        let people = isize_info_vec.pop().unwrap();
        let usize_info_vec;
        unsafe {
            usize_info_vec = isize_info_vec.iter()
            .map(|a| mem::transmute::<isize, usize>(*a)).collect::<Vec<usize>>();
        }
        bills[usize_info_vec[0]-1]
        .floars[usize_info_vec[1]-1]
        .rooms[usize_info_vec[2]-1].add_people(people);
    }
    
    print_bills(&bills);
}


Measured memory_bytes: 1060
#include <bits/stdc++.h>
template <typename T>
struct LazySegTreeAddSum {
public:
  int n;
  std::vector<T> node, lazy;
  LazySegTreeAddSum(int sz) {
    n = 1; while(n < sz) n <<= 2;
    node.resize(2*n);
    lazy.resize(2*n, 0);
  }
  LazySegTreeAddSum(std::vector<T> v) {
    int sz = (int)(v.size());
    n = 1; while(n < sz) n <<= 2;
    node.resize(2*n);
    lazy.resize(2*n, 0);
    for(int i=n-1;i<n-1+sz;++i) {
      node[i] = v[i-n+1];
    }
    for(int i=n-2;i>=0;--i) {
      node[i] = node[2*i+1] + node[2*i+2];
    }
  }
  void eval(int k, int l, int r) {
    if(lazy[k] != 0) {
      node[k] += lazy[k];
      if(r-l > 1) {
        lazy[2*k+1] += lazy[k] / 2;
        lazy[2*k+2] += lazy[k] / 2;
      }
      lazy[k] = 0;
    }
  }
  void update(int a, int b, T x, int k, int l, int r) {
    eval(k, l, r);
    if(b <= l || r <= a) return;
    if(a <= l && r <= b) {
      lazy[k] += (r - l) * x;
      eval(k, l, r);
    } else {
      update(a, b, x, 2*k+1, l, (l+r)/2);
      update(a, b, x, 2*k+2, (l+r)/2, r);
      node[k] = node[2*k+1] + node[2*k+2];
    }
  }
  void update(int a, int b, T x) {
    update(a, b, x, 0, 0, n);
  }
  T query(int a, int b, int k, int l, int r) {
    if(b <= l || r <= a) return 0;
    eval(k, l, r);
    if(a <= l && r <= b) return node[k];
    T v1 = query(a, b, 2*k+1, l, (l+r)/2);
    T v2 = query(a, b, 2*k+2, (l+r)/2, r);
    return v1 + v2;
  }
  T query(int a, int b) {
    return query(a, b, 0, 0, n);
  }
};
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int n, q; cin >> n >> q;
  LazySegTreeAddSum<ll> st(n);
  while(q) {
    q--;
    int t; cin >> t;
    if(!t) {
      int s, t, x; cin >> s >> t >> x;
      s--;
      st.update(s, t, x);
    } else {
      int s, t; cin >> s >> t;
      s--;
      cout << st.query(s, t) << endl;
    }
  }
}



Measured memory_bytes: 11028
n = gets.to_s.to_i

a = Array.new(n+1,0)
1.upto(n) do |i|
  1.upto(n) do |j|
    a[i.gcd(j)] += 1
  end
end

ans = 0
1.upto(n) do |t|
  1.upto(n) do |k|
    ans += t.gcd(k) * a[t]
  end
end

puts ans

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  bool a = true;
  for(int i = 0; i < N; i++) {
    cin >> vec.at(i);
    if(vec.at(i)%2 == 0 && vec.at(i)%3 != 0 && vec.at(i)%5 != 0)
      a = false;     
  }
   if(a)
     cout << "APPROVED" << endl;
  else
    cout << "DENIED" << endl;
}

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

#define DEBUG_MSG_off

int A,B;

int main() {
  cin >> A >> B;

  int res = max(A+B, A-B);
  res = max(res, A*B);
  cout << res << "\n";

#ifdef DEBUG_MSG
  cerr << A << " " << B << "\n";
#endif
  return 0;
}

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

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL n,k;
    cin>>n>>k;
    LL ans = 0;
    REP(i,n){
        LL h;
        cin>>h;
        if(h>=k)ans++;
    }
    PUTS(ans);
}

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

namespace atcoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var buffer = Console.ReadLine().Split();
            var N = long.Parse(buffer[0]);
            var K = long.Parse(buffer[1]);

            Console.WriteLine(K * Math.Pow(K - 1, N - 1));
        }
    }
}


Measured memory_bytes: 27928
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int input = 0;
	cin >> input;
	long long sum = 0;
	for (int i = 1; i <= input; i++)
	{
		if (i % 3 == 0)
			continue;
		if (i % 5 == 0)
			continue;
		sum += i;
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 3612
import java.util.Scanner;

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

		int n=sc.nextInt();
		int count=0;
		for(int a=0; a<=9; a++){
			for(int b=0; b<=9; b++){
				for(int c=0; c<=9; c++){
					for(int d=0; d<=9; d++){
						if((a+b+c+d)==n){
							count++;
						}
					}
				}
			}
		}
		System.out.println(count);
		}
	}

}

Measured memory_bytes: 26624
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

const double PI = 3.1415926535;

int main(){
	int n, th;
	double x = 0;
	double y = 0;
	int nth = 90;
	while(scanf("%d,%d", &n, &th)){
		if(!n&&!th) break;
		x += n*cos(PI*nth/180);
		y += n*sin(PI*nth/180);
		nth -= th;
		nth %= 360;
	}
	printf("%d\n", x > 0 ? int(x) : -1*int(-1*x));
	printf("%d\n", y > 0 ? int(y) : -1*int(-1*y));
	return 0;
}

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

int main() {
    string o, e;
    cin >> o >> e;
    
    size_t len = min(o.size(), e.size());;
    for (int i = 0; i < len; i++) cout << o[i] << e[i];
    if (o.size() > e.size()) cout << o[len];
    else if (e.size() > o.size()) cout << e[len];
    cout << endl;
}


Measured memory_bytes: 384
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

# 操作：c回と固定すると，
# 各要素を何回以上選ぶ必要があるかわかる
# c→c+(N+1) とすると，必要回数の和が+Nになることから，
# 最小のc(mod N+1)がわかる

def ceil(x,y):
    return x//y + int(x%y != 0)

N = I()
a = LI()

ans = float('inf')
for c in range(N+1):
    need = 0
    for i in range(N):
        need += max(0,ceil(c+a[i]-(N-1),N+1))
    if need <= c:
        temp = c
    else:
        temp = c+(need-c)*(N+1)
    if temp < ans:
        ans = temp

print(ans)

Measured memory_bytes: 39536
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map> 
#include <queue>
#include <string>
#include <stack>
#include <vector>
using namespace std;
typedef long long ll;
int main(){
  int n;
  cin >> n;
  vector<int> x(n);
  map<int,bool> pos;
  for(int i = 0;i < n;i++){
    cin >> x[i];
    pos[x[i]] = true;
  }

  int m;
  cin >> m;
  for(int i = 0;i < m;i++){
    int a;
    cin >> a;
    a--;
    if(x[a] == 2019)continue;

    if(pos[x[a]+1] == false){
      pos[x[a]] = false;
      pos[x[a]+1] = true;
      x[a]++;
    }
    else continue;
  }

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


Measured memory_bytes: 3112
#coding: UTF-8
import time
import collections
N=int(input())
lis=list(map(int, input().split()))
#kind=set(lis)
#kindn=len(kind)
kind_dict=collections.Counter(lis)
kindn=len(kind_dict)
out=0
for i in kind_dict:
    if kind_dict[i]%2==0:
        out+=1
if out%2==0:
    print(kindn)
else:
    print(kindn-1)

Measured memory_bytes: 18644
import itertools

n = int(input())
twn = [list(map(int, input().split())) for _ in range(n)]
twnst = list(itertools.permutations(twn))
dstttl = 0
for i in twnst:
    for j in range(0, len(i) - 1):
        dstttl += (abs(i[j][0] - i[j+1][0])**2 + abs(i[j][1] - i[j+1][1])**2)**0.5
print(dstttl / len(twnst))

Measured memory_bytes: 13840
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd_(ll a,ll b){if(a%b==0)return b;return gcd_(b,a%b);}
ll lcm_(ll a,ll b){ll c=gcd_(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop_(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}
ll ketawa(ll a){ll r=0;while(a){r+=a%10;a/=10;}return r;}


template <typename T>
class Lazy_Seg_Tree{
public: // 0-index

	T make_dat_from_buket(T da, T bu, T s){//dat[k] = make_dat_from_buket(dat[k],buket[k],r-l);
		return da + bu;
	}
	T buket_to_child(T ch, T pa){// buket[2*k+1] = buket_to_child(buket[2*k+1],buket[k]);
		return ch + pa;
	}
	T buket_update(T bu , T x , T s){// buket[k] = buket_update(buket[k],x,r-l);
		return bu + x;
	}
	T dat_update(T dc1, T dc2){// dat[k] = dat_update(dat[2*k+1],dat[2*k+2]);
		return min(dc1 , dc2);
	}

  vector<T> dat,buket;
  T initial_d,initial_b,M;
  int n;
  Lazy_Seg_Tree(int n0_=1,T initial_dat=1,T initial_buket=0 ,T M_=1){
    initsize(n0_,initial_dat,initial_buket,M_);
  }
  void initsize(int n0,T initial_da,T initial_bu,T M_){
    M = M_;
    initial_d = initial_da;
    initial_b = initial_bu;
    int k=1;
    while(k<n0)k*=2;
    n=k;
    dat.resize(2*n-1);
    buket.resize(2*n-1);
    for(int i=0;i<2*n-1;i++)dat[i]=initial_da;
    for(int i=0;i<2*n-1;i++)buket[i]=initial_bu;
  }
	
	void eval(int k,int l,int r){
		if(buket[k] != initial_b){
			dat[k] = make_dat_from_buket(dat[k],buket[k],r-l);
			if(r-l>1){
				buket[2*k+1] = buket_to_child(buket[2*k+1],buket[k]);
				buket[2*k+2] = buket_to_child(buket[2*k+2],buket[k]);
			}
			buket[k] = initial_b;
		}
	}

	void operate(int a,int b, T x, int k=0,int l=0, int r=-1){
		if(r<0)r=n;
		eval(k,l,r);
		if(b<=l || r<=a)return;
		if(a<=l && r<=b){
			buket[k] = buket_update(buket[k],x,r-l);
			eval(k,l,r);
		}else{
			operate(a,b,x,2*k+1,l,(l+r)/2);
			operate(a,b,x,2*k+2,(l+r)/2,r);
			dat[k] = dat_update(dat[2*k+1],dat[2*k+2]);
		}
	}
	T get(int a,int b,int k=0,int l=0,int r=-1){
		if(r<0)r=n;
		if(b<=l || r<=a) return initial_d;
		eval(k,l,r);
		if(a<=l && r<=b) return dat[k];
		T vl = get(a,b,2*k+1,l,(l+r)/2);
		T vr = get(a,b,2*k+2,(l+r)/2,r);
		return dat_update(vl,vr);
	}
};



int main(){

	ll n,q;
	cin >> n >> q;
	Lazy_Seg_Tree<ll> sg(n,INF,0,MOD);
	sg.operate(0,n,-INF,0,0,-1);
	FOR(i,0,q){
		ll q_,s,t,x;
		cin >> q_;
		if(q_){
			cin >> s >> t;
			cout << sg.get(s,t+1,0,0,-1) << "\n";
		}else{
			cin >> s >> t >> x;
			sg.operate(s,t+1,x,0,0,-1);
		}
	}


}



Measured memory_bytes: 7072
INF = float("inf")

N, M, X = map(int, input().split())
A = [[int(i) for i in input().split()] for _ in range(N)]

ans = INF
for i in range(2 ** N):
    B = [0] * M
    S = 0
    for j, (c, *a) in enumerate(A):
        if (i >> j) & 1:
            S += c
            for k, ak in enumerate(a):
                B[k] += ak
    if all(b >= X for b in B):
        ans = min(ans, S)

if ans == INF:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 9224
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <utility>
using namespace std;
#define MAXSIZE 200
#define MAXL 100
typedef long long int lli;

int main(){
    int n;
    cin >> n;
    int ans = 0, maxh = 0;
    for(int i = 0; i != n; ++i){
        int h;
        cin >> h;
        
        if(max(h, maxh) == h) ans += 1;

        maxh = max(h, maxh);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
fun main (args : Array<String>) {
	val s = readLine()
	val S : String = s!!.toString()
	var list : MutableList<Int> = mutableListOf()
	var calc1 : Int 
	var calc2 : Int
	var result : Int = 0
	for (i in S) {
		list.add(i.toString().toInt())
	}
	for (i in 0..list.size - 3) {
		calc1 = (list[i] * 100) + (list[i + 1] * 10) + (list[i + 2])
		calc2 = 753 - calc1
		if (calc2 < 0) {
			calc2 = -(calc2)
		}
		if (i == 0) {
			result = calc2
		}
		if (result > calc2) {
			result = calc2
		}
	}
	println("${result}")
}

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

using namespace std;

using ll = long long;


bool check(int pos, int n, const string &s, const string &t, const string &lr)
{
	vector<int> l(s.size() + 1), r(s.size() + 1);

	for (int i = s.size() - 1; i >= 0; i--)
	{
		l[i] = l[i + 1];
		r[i] = r[i + 1];

		if (t[i] == lr[0])
			r[i]--;
		if (t[i] == lr[1])
			l[i]--;
		l[i] = max (l[i], 0);
		r[i] = max (r[i], 0);
		if (s[i] == lr[0])
			l[i]++;
		if (s[i] == lr[1])
			r[i]++;
	}

	int lpos = pos, rpos = pos;

	for (int i = 0; i < (int) s.size(); i++)
	{
		lpos = max(lpos, l[i]);
		rpos = min(rpos, n - r[i] - 1);

		if (rpos < lpos)
			return false;

		if (lpos != rpos)
		{
			if (s[i] == lr[0])
				rpos--;
			if (s[i] == lr[1])
				lpos++;
		}

		if (t[i] == lr[0])
			lpos--;
		if (t[i] == lr[1])
			rpos++;

		lpos = max(lpos, l[i + 1]);
		rpos = min(rpos, n - r[i + 1] - 1);

		if (rpos < lpos)
			return false;
	}

	return true;
}


void solve(istream &cin = std::cin, ostream &cout = std::cout)
{
	int h, w, n;

	cin >> h >> w >> n;

	int r, c;

	cin >> r >> c;
	r--;
	c--;

	string s, t;

	cin >> s >> t;

	cout << (check(c, w, s, t, "LR") && check(r, h, s, t, "UD") ? "YES" : "NO") << endl;
}


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

	cout << fixed;

#ifdef LOCAL
	ifstream fin("../input.txt");

	solve(fin);

	cout << setprecision(4) << "clock: " << clock() / (double) CLOCKS_PER_SEC << endl;
#else
	cout << setprecision(20);

	solve();
#endif

	return 0;
}


Measured memory_bytes: 2456
#include<iostream>

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if ((a*b) % 2 == 0) {
		cout << "Even" << endl;
		return 0;
	}
	else {
		cout << "Odd" << endl;
		return 0;
	}
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
     public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		if(a == 1){
			a=a+13;
		}
		if(b == 1){
			b=b+13;
		}
		if(a == b) {
			System.out.println("Draw");
		}else if(a > b) {
			System.out.println("Alice");
		}else {
			System.out.println("Bob");
		}
	}
 
}

Measured memory_bytes: 21972
import Control.Applicative

main = do _ <- getLine
          xs <- map (map read . words) . lines <$> getContents
          putStr . unlines . map (unwords . map show) . addRow $ map sumRow xs

sumRow :: [Int] -> [Int]
sumRow x = x ++ ((sum x):[])

addRow :: [[Int]] -> [[Int]]
addRow xs = xs ++ (makeRow xs:[])

makeRow :: [[Int]] -> [Int]
makeRow (x:_) | x==[] = []
makeRow xs = (sum $ map head xs) : makeRow (map tail xs)

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

int main(){
	int tam, K, i;
	char cadena[100];
	cin>>K;
	cin>>cadena;
	if(strlen(cadena)<=K){
		cout<<cadena<<endl;
	}else{
		for(i=0; i<K; i++){
			cout<<cadena[i];
		}cout<<"..."<<endl;
	}
}

Measured memory_bytes: 3632
import sys
from collections import deque


N = int(input())
edge = [[] for _ in range(N)]
for i, s in enumerate(sys.stdin.readlines()):
    a, b = map(int, s.split())
    a -= 1; b -= 1
    edge[a].append((b, i))
    edge[b].append((a, i))


path = [None] * (N - 1)
q = deque()
q.append((0, 0))

while q:
    v, pc = q.popleft()
    c = 1
    for nv, i in edge[v]:
        if path[i] is None:
            c = c + 1 if c == pc else c
            path[i] = c
            q.append((nv, c))
            c += 1

print(max(path))
print(*path, sep='\n')


Measured memory_bytes: 44648
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
typedef long long LL;
const int MOD=998244353;
const int N=205;
int n;
struct qq
{
	int x,y;
	void print ()	{printf("%d %d\n",x,y);}
}a[N],b[N];
int tot;
int ans;
qq tmp;
int mul (qq x,qq y,qq z)
{
	int x1=x.x-z.x,y1=x.y-z.y;
    int x2=y.x-z.x,y2=y.y-z.y;
    return x1*y2-x2*y1;
}
int dis (qq x,qq y)	{return (x.x-y.x)*(x.x-y.x)+(x.y-y.y)*(x.y-y.y);}
bool cmp (qq x,qq y)
{
	if (mul(x,y,tmp)==0) return dis(x,tmp)<dis(y,tmp);
	return mul(x,y,tmp)>0;
}
bool cmp1 (int x,int y)
{
	if (mul(b[x],b[y],tmp)==0) return dis(b[x],tmp)<dis(b[y],tmp);
	return mul(b[x],b[y],tmp)>0;
}
bool check (qq x,qq y,qq z)//z是否在 (tmp,x,y)
{
	if (mul(z,x,tmp)==0) return false;
	if (mul(z,y,x)>0) return false;
	return true;
}
int f[N][N];
int g[N][N];
int mul (int x,int y)	{return (LL)x*y%MOD;}
int add (int x,int y)	{x=x+y;return x>=MOD?x-MOD:x;}
int id[N],id1[N];
int m,m1;
int Pow[N];
void solve (int x)
{
	//printf("solve:%d\n",x);
	tot=0;tmp=a[x];
	for (int u=1;u<=n;u++)
	{
		if (a[u].y>a[x].y||(a[u].y>=a[x].y&&a[u].x>=a[x].x))	b[++tot]=a[u];
	}
	sort(b+1,b+1+tot,cmp);
	for (int u=1;u<=tot;u++)	
		for (int i=1;i<=tot;i++)
			g[u][i]=f[u][i]=0;
	/*for (int u=1;u<=tot;u++)
		for (int i=u+1;i<=tot;i++)
		{
			int lalal=0;
			for (int k=u+1;k<i;k++)
			{
				if (mul(b[k],b[u],tmp)==0) continue;
				if (mul(b[k],b[i],b[u])<=0) lalal++;
			}
			g[u][i]=Pow[lalal];
		}*/
	for (int u=1;u<=tot;u++)
		for (int i=u+1;i<=tot;i++)
			g[u][i]=1;
	for (int u=1;u<=tot;u++)
		for (int k=u+1;k<=tot;k++)
		{
			if (mul(b[k],b[u],tmp)==0) continue;
			for (int i=k+1;i<=n;i++)
			{
				if (mul(b[k],b[i],b[u])<=0)
				g[u][i]=add(g[u][i],g[u][i]);
			}
		}
	for (int u=2;u<=tot;u++)
	{
		f[1][u]=1;
		for (int i=2;i<u;i++)
			if (mul(b[i],b[u],b[1])==0)
				f[1][u]=add(f[1][u],f[1][u]);
	}
	for (int i=2;i<=tot;i++)
	{
		//printf("i:%d\n",i);
		m=0;m1=0;
		for (int u=1;u<i;u++)	id[++m]=u;
		for (int u=i+1;u<=tot;u++) id1[++m1]=u;
		tmp=b[i];
		sort(id+1,id+1+m,cmp1);
		sort(id1+1,id1+1+m1,cmp1);
		int now=1,k=m1,sum=0;
		for (int u=1;u<=m1;u++)
		{
			while (now<=m&&mul(b[id1[u]],b[i],b[id[now]])<0)
			{
				sum=add(sum,f[id[now]][i]);
				now++;
			}
			f[i][id1[u]]=add(f[i][id1[u]],mul(sum,g[i][id1[u]]));
		}
	}
	for (int u=2;u<=tot;u++)
		for (int i=u+1;i<=tot;i++)
			ans=add(ans,f[u][i]);
}
int main()
{
	scanf("%d",&n);
	Pow[0]=1;for (int u=1;u<=n;u++) Pow[u]=add(Pow[u-1],Pow[u-1]);
	for (int u=1;u<=n;u++)	scanf("%d%d",&a[u].x,&a[u].y);
	for (int u=1;u<=n;u++) solve(u);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 640
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i==n-1];};
struct compare{
    bool operator() (lpair l1, lpair l2){
         if(l1.second == l2.second){
             return l1.first < l2.first;
         }
         return l1.second < l2.second;
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M;
    cin >> N >> M;
    ll A[100010], B[100010];
    rep(i,0,N) cin >> A[i] >> B[i];
    rep(i,0,N) A[i] = M - A[i];
    vector<lpair> lp;
    rep(i,0,N) lp.push_back(make_pair(A[i], B[i]));
    sort(lp.begin(), lp.end(), greater<lpair>());
    ll ans = 0;
    priority_queue<lpair, vector<lpair>, compare> pq;
    priority_queue<lpair, vector<lpair>, compare > pq2;
    rep(i,0,N) pq.push(lp[i]);
    sort(lp.begin(), lp.end(), greater<lpair>());
    ll idx = 0;
    // rep(i,0,N) print2(lp[i].first, lp[i].second);
    rrep(i,M,0){
        while(!pq2.empty()){
            lpair l1 = pq2.top();
            // print2(l1.first, l1.second);
            ans += l1.second;
            pq2.pop();
            break;
        }
        while(idx < N && lp[idx].first >= i-1){
            pq2.push(lp[idx]);
            idx++;
        }

    }
    print(ans);
    
}

Measured memory_bytes: 8048
fun main(args: Array<String>) = println(run {
    tailrec fun gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a % b)
    val (a,b,c) = readLine()!!.split(" ").map { it.toInt() }

    if(c==0 || c%gcd(a,b)==0) "YES" else "NO"

})


Measured memory_bytes: 37724
#include<bits/stdc++.h>
using namespace std;
int n,s,j;
char a;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
    	cin>>a;
    	if(a=='I')
    	{
    		s++;
		}
		else
			s--;
			if(s>j) j=s;
	}
	cout<<j<<endl;
    
    
     

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
  int N,T;
  cin >> N >> T ;
  vector<int>c(N,0);
  vector<int>t(N,0);
  int MAX=1<<30;
  int ans=MAX;
  rep(i,N) cin >> c[i] >> t[i];

  rep(i,N){
    if(t[i]<=T){
      ans=min(ans,c[i]);
    }
  }

  if(ans<MAX){
    cout << ans <<endl;
  }
  else
  {
    cout << "TLE" << endl;
  }
  
  
  
  return 0;
}

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

#define ll long long
// #define endl '\n'

// void max_self(int &a, int b){a = max(a, b);}
// void min_self(int &a, int b){a = min(a, b);}

void solve(){
	string s; cin>>s;
	int r = s.length() - 1, l = 0, cnt = 0;
	while(l < r){
		if(s[l] != s[r]) cnt++;
		l++;
		r--;
	}
	cout<<cnt<<endl;

}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int t = 1; //cin>>t;
	for(int i = 1; i<=t; i++){
		solve();
	}
	return 0;
}


Measured memory_bytes: 3640
import java.io.*;
import java.util.*;
public class Main{
	public static void main(String[] args)throws IOException{
		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
		//Scanner reader=new Scanner(System.in);
		String s=reader.readLine();
		int in=Integer.parseInt(s);
		//int in=reader.nextInt();
		int[] out=new int[in];
		for(int i=1;i<=in;i++)out[i-1]=i;
		//in=reader.nextInt();
		s=reader.readLine();
		in=Integer.parseInt(s);
		for(int i=0;i<in;i++){
			String s1=reader.readLine();
			String[] in1=s1.split(",");
			int a=Integer.parseInt(in1[0]);
			int b=Integer.parseInt(in1[1]);
			int tmp=out[a-1];
			out[a-1]=out[b-1];
			out[b-1]=tmp;
		}
		for(int i=0;i<out.length;i++)System.out.println(out[i]);
	}
}

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

int main()
{
    int n;
    cin>>n;
    if (n%2==0){
        cout<<((n/2)*(n/2));
    }
    else
        cout<<(n/2)*((n/2)+1);


return 0;
}

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

int main() {
  int n;
  
  cin >> n;
  
  set<string> s;
  set<string>::iterator it;
  char query[5]; string str;
    
  for(int i=0; i<n; i++) {
    scanf("%s", query);
    if(query[0] == 'i') {
      cin >> str;
      s.insert(str);
    }
    else {
      cin >> str;
      it = s.find(str);
      if(it == s.end()) cout << "no" << endl;
      else cout << "yes" << endl;
    }
  }
  
  return 0;
}

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

int main()
{
    char str[210]={};
    int len;
    int i,j,k;
    while (scanf("%s",str)!=EOF)
    {
        len=strlen(str);
        len--;
        if (len%2!=0)
            len--;
        for (i=len/2;i!=0;len=len-2,i=len/2)
        {
            for (j=0,k=i;k<len;j++,k++)
            {
                if (str[j]!=str[k])
                    break;
            }
            if (k==len)
                break;
        }
        if (i==0)
            printf("0\n");
        else
            printf("%d\n",len);
    }
    return 0;
}

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

using namespace std;

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

  string s;
  cin >> s;
  int sum = 0;
  for (auto i : s) {
    if (i == '1') {
      sum++;
    }
  }
  cout << sum << endl;
}


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

int main() {
  int N;
  cin >> N;
  if (N < 3) {
    cout << 0 << endl;
  } else {
  
  vector<int> vec(N);
  for (int l = 0; l< N; l++) {
    cin >> vec.at(l);
  }
  sort(vec.begin(), vec.end());
  
  int count = 0;
  
  for (int i = 0; i < N-2; i++) {
    for (int j = i+1; j < N-1; j++) {
      for (int k = j+1; k < N; k++) {
        if (vec.at(i) != vec.at(j) && vec.at(i) != vec.at(k) && vec.at(j) != vec.at(k)){
          if (vec.at(i) + vec.at(j) > vec.at(k)) {
            count++;
          }
        }
      }
    }
  }

  cout << count << endl;
  }
}

Measured memory_bytes: 3616
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#include "queue"
#include "functional"
#include "map"
#include "unordered_map"
#include "set"

#define lp(n) for (int i = 0; i < n; i++)
#define LP(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nya_n "(=^･ω･^=)"
typedef long long ll;
using namespace std;


/*
ll gcd(ll x, ll y) {
if (y == 0) return x;
return gcd(y, x%y);
}
/*
ll lcm(ll x, ll y) {
ll g = gcd(x, y);
return x / g * y;
}
ll pw(int x, int n) {
	ll y = 1;
	ll p = x;
	while (n != 0) {
		if (n % 2) {
			y = y*p%mod;
			n = n - 1;
		}
		else {
			p = p*p%mod;
			n = n / 2;
		}
	}
	return y;
}

ll modinv(ll x) {
	return pw(x, mod - 2);
}*/

int n, m, Q, p, q, l, r;
ll cnt, g[500][500];

int main() {
	cin >> n >> m >> Q;
	lp(n)
		LP(n, j)
			g[i][j] = 0;
	lp(m) {
		cin >> l >> r;
		g[l - 1][r - 1]++;
	}
	lp(n) {
		LP(n - 1, j) {
			g[i][j + 1] += g[i][j];
//			cout << g[i][j] << sp;
		}
//		cout << g[i][n - 1] << endl;
	}
	lp(Q) {
		cin >> p >> q;
		cnt = 0;
		if (p == 1) {
			LP(q, j) {
				cnt += g[j][q - 1];
			}
		}
		else for (int j = p-1; j < q;j++) {
			cnt += g[j][q - 1];
			cnt -= g[j][p - 2];
		}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 2816