akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(int i = 0; i < n; i++)




int main() {
    ll n;
    cin >> n;
    
    vector<ll> t(n), x(n), y(n);
    REP(i, n){
        cin >> t[i] >> x[i] >> y[i];
    }
    
    ll tt = 0, xx = 0, yy = 0;
    REP(i, n){
        ll ttt = t[i] - tt, xxx = abs(xx - x[i]), yyy = abs(yy - y[i]);
        
        if(ttt < xxx + yyy || ((ttt % 2) != ((xxx + yyy) % 2))){
            cout << "No" << endl;
            return 0;
        }
        
        tt = t[i];
        xx = x[i];
        yy = y[i];
    }
    
    cout << "Yes" << endl;
}

Measured memory_bytes: 2560
#include "bits/stdc++.h"
#define int long long
#define range(i, a, b) for(auto i = a; i < b; i++)
#define rep(i, a) range(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const long double EPS = 1e-8;
using vi = vector <int>;
using vvi = vector <vi>;

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


Measured memory_bytes: 512
using System;
using System.Linq;

namespace lineAralgebra
{


	class Program
	{
		static void Main(string[] args)
		{
			var input = Console.ReadLine().Split().Select(int.Parse).ToArray();

			if (input[0] < 10 && input[1] < 10) {
				System.Console.WriteLine(input[0] * input[1]);
			} else {
				System.Console.WriteLine(-1);
			}
		}
	}
}

Measured memory_bytes: 13268
#include<stdio.h>
int main()
{
  int n,r,h1=0,h2=0,h3=0;
  for(r=0; r<10; r++)
    {
      scanf("%d",&n);
      if(n>=h1)
	{
	  h3=h2;
	  h2=h1;
	  h1=n;
	}
      else if(n>=h2)
	{
	  h3=h2;
	  h2=n;
	}
      else if(n>=h3) h3=n;
    }
  printf("%d\n%d\n%d\n",h1,h2,h3);
  return 0;
}

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

int main() {

  int n,k;
  cin >>n >>k; 
  vector<int> pt(n);
  rep(i,n){
  cin >> pt.at(i);
  }
  int X = 0;
  sort(pt.begin(), pt.end());
  rep(i,k){
  X = X + pt.at(i);
  }
  cout << X <<endl;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <numeric>
#include <iostream>
#include <vector>
#include <set>
#include <cstring>
#include <string>
#include <map>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <queue>
#include <sstream>
#include <deque>

using namespace std;

#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); i++)
#define re return
#define fi first
#define se second
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define sqrt(x) sqrt(abs(x))
#define y0 y3487465
#define y1 y8687969
#define fill(x,y) memset(x,y,sizeof(x))
#define prev PREV
#define next NEXT
                         
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef double D;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<vi> vvi;

template<class T> T abs(T x) { re x > 0 ? x : -x; }
template<class T> inline T sqr (T x) { re x * x; }

#define filename ""

int n;
int m;
string s[300];
string x, y;
int res[310][310];
int cost[310][310];

int calc (int a, int b) {
	x = y = "";
	for (int i = 0; i < n; i++) {
		x += s[i][a];
		y += s[i][b];
	}
	reverse (all (x));
	reverse (all (y));
	memset (cost, 0, sizeof (cost));
	memset (res, 0, sizeof (res));
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			if (x[i] == y[j])
				cost[i][j]++;
	for (int i = n - 1; i >= 0; i--)
		for (int j = n - 1; j >= 0; j--) {
			cost[i][j] += cost[i + 1][j + 1];
			res[i][j] = min (res[i + 1][j], res[i][j + 1]) + cost[i][j];
		}
	re res[0][0];
}

int main () {
	cin >> n >> m;
	for (int i = 0; i < n; i++) cin >> s[i];
	int ans = 0;
	for (int i = 0; i + 1 < m; i++) ans += calc (i, i + 1);
	printf ("%d\n", ans);
	return 0;
}

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

// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

typedef long long ll; 
typedef long double ld; 
typedef pair<int,int> p32;   
typedef pair<ll,ll> p64;  
typedef pair<double,double> pd; 
typedef pair<ld,ld> pld; 
typedef vector<int> v32;  
typedef vector<ll> v64;  
typedef vector<pd> vpd;   
typedef vector<p32> vp32;  
typedef vector<p64> vp64;  
typedef vector<v32> vv32;  
typedef vector<v64> vv64;  

#define pb push_back
#define mp make_pair
#define prarr(a,n) cerr<<#a<<" : ";for(ll i=0;i<n;i++) cerr<<a[i]<<" "; cerr<<endl;
#define prmat(mat,row,col) cerr<<#mat<<" :\n";for(ll i=0;i<row;i++) {for(ll j=0;j<col;j++) cerr<<mat[i][j]<<"\t";cerr<<endl;}
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
#define all(a) a.begin(),a.end()
#define sz(x) ((int)x.size())
#define endl '\n'
#define fast_io ios_base::sync_with_stdio(NULL); cin.tie(NULL)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {ll idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
template <class T> void prall(T a) { prc(all(a)); }


const int inf=1000*1000*1000+9; 
const ll infl=1ll*inf*inf; 
int mod=1000*1000*1000+7;  
// ---------------------------------------------------------------------------- -------------- 



void solve(){
  int m,k; cin>>m>>k; 
  int n=1<<m;   
  if(k>=n) {
    cout<<-1; return; 
  }
  if(k==0){
    for(int i=0;i<n;i++){
      cout<<i<<" " <<i<<" " ; 
    }
    cout<<endl; 
  }
  else {
    if(n<=2){
      cout<<-1<<endl; return; 
    }
    for(int i=0;i<n;i++)  {
      if(i==k) continue; 
      cout<<i<<" "; 
    }
    cout<<k<<" " ; 
    for(int i=n-1;i>=0;i--){
      if(i==k) continue; 
      cout<<i<<" " ; 
    }
    cout<<k<<" " ; 
  }
  cout<<endl; 
}

int main(){
	// clock_t beg=clock(); 
  fast_io; 
  int testcases=1; 
  // cin>>testcases; 
  cout << fixed << setprecision(13); 
  while(testcases--){
    solve(); 	
  }
	// clock_t end=clock(); 
	// fprintf(stderr, "%lf\n", (double)(end-beg)/(CLOCKS_PER_SEC));
}


Measured memory_bytes: 1792
import cmath, math

a,b,dig = map(float, input().split())

th = math.radians(dig)
pos_a = complex(a,0.0)
pos_b = cmath.rect(b,th)

c = abs(pos_a-pos_b)

print (pos_a.real * pos_b.imag /2.0)
print (a + b + c)
print (pos_b.imag)



Measured memory_bytes: 5736
#include<bits/stdc++.h>
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
char buf[1<<21],*p1=buf,*p2=buf;

using namespace std;
const int N=1e5+10;
int T,n,j,ans,a[N];

inline int read(){
    int ret=0,ff=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-') ff=-ff;ch=getchar();}
    while(isdigit(ch)){ret=(ret<<3)+(ret<<1)+ch-'0';ch=getchar();}
    return ret*ff;
}
void write(int x){
    if(x<0){x=-x;putchar('-');}
    if(x>9) write(x/10);
    putchar(x%10+48);
}

int main(){

	    scanf("%d",&n);
	    for (register int i=1; i<=n; ++i) scanf("%d",&a[i]);
	    sort(a+1,a+n+1);
		reverse(a+1,a+n+1);	 
	    for (register int i=1; i<=n; ++i)
	    if (i+1>a[i+1])
		{
		//	printf("%d\n",i);
	    	j=i+1,ans=0; 
			while (a[j]==i) ans++,j++;
			if (ans%2==1 || (a[i]-i)%2==1) puts("First");
			else puts("Second");
			break;
	    }
}

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

int main() {
    int h, w;
    while(cin >> h >> w){
        if(h==0 && w==0) break;
        for(int i=0; i<h; i++){
            for(int j=0; j<w; j++){
                if(i==0 || j==0 || i==h-1 || j==w-1){
                    cout << "#";
                }
                else{
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
using ll = long long;
using namespace std;

int main(){
	int n, mod; cin >> n >> mod;
	vector<ll> a(n), sum(n+1);
	for( auto &k : a ){
		cin >> k;
		--k;
	}
	sum[0] = 0;
	for( int i = 0; i < n; ++i ){
		sum[i+1] = sum[i]+a[i];
		sum[i+1] %= mod;
	}
	map<ll, vector<int>> mp;
	for( int i = 0; i <= n; ++i ){
		mp[sum[i]].push_back(i); 
	}
	ll ans = 0;
	for( auto &k : mp ){
		vector<int> dist;
		auto &r = k.second;
		for( int i = 0; i < r.size()-1; ++i ){
			dist.push_back(r[i+1]-r[i]);
		}
		vector<int> disum(r.size());
		disum[0] = 0;
		for( int i = 0; i < r.size()-1; ++i ){
			disum[i+1] = disum[i] + dist[i];
		}
		for( int l = 0; l < disum.size(); ++l ){
			int r = lower_bound(disum.begin(), disum.end(), disum[l]+mod) - disum.begin();
			ans += r-l-1;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 25216
# (X-D) mod D = (X+D) mod D
#  |Y-X|/D mod 2 = K mod 2

X,K,D = map(int,input().split())

X = abs(X)

if X >= K*D:
    print(X-K*D)
    exit()

n = X//D
x = X%D
k = K-n

if k%2==0:
    print(x)
else:
    print(abs(x-D))


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

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

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

	int ans = 0;
	char c;

	for (int i = 0;i < 4;i++){
		cin >> c;
		ans += (c == '+'? 1 : -1);
	}

	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
 
class Program{
    static void Main(){
        int[] inputs = Console.ReadLine().Split(' ')
                                         .Select(val => int.Parse(val))
                                         .ToArray();
        int n = inputs[0];
        int k = inputs[1];
        int[] w = new int[n];
        for (int i = 0; i < n; i++)
        {
            w[i] = int.Parse(Console.ReadLine());
        }
        Console.WriteLine(Solve(w, k));
    }

    static long Solve(int[] baggage, int k){
        long l = 0;
        long r = 100000 * 10000 + 1;
        long mid = (r + l) / 2;
        while(l < r - 1){
        //for(int i = 0; i < 10; i++){
            mid = (r + l) / 2;
            int num = NumberOfBaggage(baggage, mid, k);
            //Console.Error.WriteLine("num: {0}, l: {2}, mid: {1}, r: {3}", num, mid, l, r);
            //if(num == baggage.Length) break;
            if(num >= baggage.Length) r = mid;
            else l = mid;
        }
        return r;
    }

    static int NumberOfBaggage(int[] baggage, long P, int k){
        int j = 0;
        for (int i = 0; i < k; i++)
        {
            long sum = 0;
            while(sum + baggage[j] <= P){
                sum+= baggage[j];
                j++;
                if(j >= baggage.Length) return j;
            }
        }
        return j;
    }
}

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

int main(){
    string s;
    cin >> s;
    int frg=0;
    for(int i=1;i<s.size();i++){
        if(s[i-1]=='A' && s[i]=='C')frg=1;
    }
    if(frg)cout << "Yes" <<  endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

using namespace std;
#define all(c) begin(c), end(c)
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using ll = long long;
using pii = pair<int, int>;
#define VV(T) vector<vector< T > >

int n;
int a[25];
double dp[25][200000];
double inf = 1e9;

double solve() {
    fill((double*)begin(dp), (double*)end(dp), inf);
    dp[0][1] = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 1; j < 200000; ++j) {
            for (int k = j; k < 200000; k += j) {
                double nxt = dp[i][j];
                nxt = max(nxt, abs((double)(a[i] - k) / a[i]));
                dp[i + 1][k] = min(dp[i + 1][k], nxt);
            }
        }
    }
    return *min_element(begin(dp[n]), end(dp[n]));
}

int main() {
    while (cin >> n) {
        for (int i = 0; i < n; ++i) {
            cin >> a[i];
        }
        printf("%.10lf\n", solve());
    }
}

Measured memory_bytes: 42220
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;

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

template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;

int main() {
	int n, m;
	cin >> n >> m;
	V<int> h(n), v(n,1);
	rep(i, n) {
		cin >> h[i];
	}
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		if (h[a] >= h[b]) {
			v[b] = 0;
		}
		if (h[a] <= h[b]) {
			v[a] = 0;
		}
	}
	int cnt = 0;
	rep(i, n) {
		if (v[i] > 0) ++cnt;
	}

	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 4052
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = Integer.parseInt(Integer.toString(a)+Integer.toString(b));
		int d = (int)Math.sqrt(c);
		boolean isSquare = c == d*d;
		System.out.println(isSquare ? "Yes" : "No");
	}
}


Measured memory_bytes: 23636
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <cctype>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <set>
#include <deque>
#include <map>
#include <bitset>
#include <functional>
#include <cmath>

#define INF 1000000000
using namespace std;

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

    vector<long long> data(n+1);
    for(long long i = 0; i <= n; i++){
        data[i] = 1;
    }

    for(long long i = 2; i <= n; i++){
        for(long long j = 1; i*j <= n; j++){
            data[i*j] += 1;
        }
    }

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

    cout << ans << endl;
}

Measured memory_bytes: 81396
#include <bits/stdc++.h>
#define PI 3.1415926535897932384626433832795029L
using namespace std;
const int INF = (int)2e9 + 1;
const long long LINF = (long long)9e18 + 1;
const int POINT = 180;

long double check_rad(long double rad) {
  if (rad <= -PI) {
    rad += 2 * PI;
  } else if (rad > PI) {
    rad -= 2 * PI;
  }

  return rad;
}
bool check_direction(complex<long double> comp, long double term_m,
                     double term_p) {
  long double now = arg(comp);

  if (term_m < term_p) {
    if (term_m <= now && now <= term_p)
      return true;
    else
      return false;
  } else {
    if (term_m <= now || now <= term_p)
      return true;
    else
      return false;
  }

  return -1;
}

long double Pythagoras(long double x, long double y) {
  return sqrtl(powl(x, 2) + powl(y, 2));
}

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

  int N;
  cin >> N;
  vector<complex<long double>> engine(N);
  for (auto &v : engine) {
    long double in1, in2;
    cin >> in1 >> in2;
    v.real(in1);
    v.imag(in2);
  }

  long double max_d = 0;
  for (int i = 0; i < POINT; i++) {
    long double temp_arg =
        check_rad((-(long double)i * 2 / POINT + 1) * (long double)PI);
    long double temp_plus90 = check_rad(temp_arg + PI / 2);
    long double temp_minus90 = check_rad(temp_arg - PI / 2);

    long double now_x = 0, now_y = 0;
    for (auto &v : engine) {
      if (check_direction(v, temp_minus90, temp_plus90)) {
        now_x += v.real();
        now_y += v.imag();
      }
    }
    long double now_d = Pythagoras(now_x, now_y);
    if (max_d < now_d) {
      max_d = now_d;
    }
  }

  cout << setprecision(52) << max_d << endl;

  return 0;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n:usize,
        m:usize,
        a:[usize;n],
        mut bc:[[usize;2];m],
    }
    for i in 0..n {
        bc.push(vec![1,a[i]]);
    }
    bc.sort_by(|x,y|{
        y[1].cmp(&x[1])
    });
    // println!("{:?}", bc);
    let mut ans:usize = 0;
    let mut limit = 0;
    for i in 0..n+m {
        //bc[i][0]
        if limit + bc[i][0] > n {
            ans+=(n-limit) * bc[i][1];
            break;
        }
        ans+=bc[i][0] * bc[i][1];
        limit += bc[i][0];
    }
    println!("{}", ans);
}

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

int main(){
    long Q, H, S, D, N;
    cin >> Q >> H >> S >> D >> N;
    cout << min({Q * 8, H * 4, S * 2, D}) * (N / 2) + min({Q * 4, H * 2, S}) * (N % 2) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n;
  int ans=0;
  char s[100001];
  scanf("%d %s",&n,s);
  for(int i=0;i<n;i++){
    if(s[i]!=s[i+1]){
      ans++;
    }
  }
  printf("%d",ans);
  return 0;
}

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

#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n'
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
const ll INF = LLONG_MAX/2;
const ll MOD = 1e9+7;


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll X,A;cin>>X>>A;
  cout<<(X<A?0:10)<<endl;
  return 0;
}


Measured memory_bytes: 768
n,m=map(int,input().split())
a=list()
for i in range(n):
    a.append(list(map(int,input().split())))
b=list()
for i in range(m):
    b.append(int(input()))
for i in range(n):
    ans=0
    for j in range(m):
        ans+=a[i][j]*b[j]
    print(ans)


Measured memory_bytes: 6008
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
//#include<unordered_map>//イテレータあるけど順序保持しないmap
//#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<valarray>//なんとなく追加
//メモ：表示桁数を大きくする　　cout << fixed << setprecision(20) << cm << endl;
using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PI acos(-1.0)
#define answer(ans) cout<<ans<<endl;
#define input(N) cin >> N ;


signed main() {
string S;
int ans=0,tmp=0;
cin >>S;
REP(i,S.size()){
    if(S[i]=='A'||S[i]=='G'||S[i]=='C'||S[i]=='T'){
        tmp+=1;
        ans= max(ans,tmp);
    }
    else tmp=0;
}
answer(ans);
return 0;
}


Measured memory_bytes: 3592
a1,b1=map(int,input().split())
a2,b2=map(int,input().split())
a3,b3=map(int,input().split())
a4,b4=map(int,input().split())
a5,b5=map(int,input().split())
a6,b6=map(int,input().split())
a7,b7=map(int,input().split())

print(a1-b1)
print(a2-b2)
print(a3-b3)
print(a4-b4)
print(a5-b5)
print(a6-b6)
print(a7-b7)



Measured memory_bytes: 5588
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <stack>

using namespace std;

int main(){
  int N,X,count,sum;
  int m[200];
  cin >> N >> X;

  for(int i=0;i<N;++i){
    cin >> m[i];
    X -= m[i];
  }
  sort(m,m+N);
  count = N;
  count += X/m[0];
  cout << count << endl;
}

Measured memory_bytes: 256
// Your day breaks, your mind aches
// You find that all the words of kindness linger on
// When she no longer needs you
//#pragma GCC optimize ("Ofast,unroll-loops")
//#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <unistd.h>
using namespace std;
#define fastio ios::sync_with_stdio(0);cin.tie(0)
#define debug(x) cout << #x << " = " << x << endl
#define For(i,a,b) for (int i = a; i < b; i++)
#define roF(i,a,b) for (int i = a; i >= b; i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(v) (v).begin(),(v).end()

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const int N = 1e6;
const ll INF = 1e18;
const ld EPS = 10e-9;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll random(ll a, ll b) { return uniform_int_distribution<ll> (a, b) (rng); }

void solve() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int ans = 0;
	For(i,0,n-2) {
		if (s[i] == 'A' and s[i + 1] == 'B' and s[i + 2] == 'C') ans++;
	}
	cout << ans << endl;
}

int main() {
	fastio;
	int t = 1;
	//cin >> t;
	while (t--) solve();
	return 0;
}


Measured memory_bytes: 256
n = gets.chomp.to_i
a = gets.chomp.split(' ').map(&:to_i)
memo = {}
n.times.with_index do |i|
  memo[i+1] = 0
end

a.each do |boss|
  memo[boss] += 1
end

memo.sort.each do |arr|
  puts arr[1]
end

Measured memory_bytes: 55456
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_4_B&lang=jp

#include<iostream>
 using namespace std;

int main(){

    double r ;
    cin >> r ;
    
    cout << fixed; //精度保障のためこの記述が必要なようです。
    cout <<  r * r * 3.1415926535897 << " " << 2 * r * 3.1415926535897 << endl ;  
    return 0;

}


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

int main() {
    ll N;
    cin >> N;
    vector<ll> a(N), b(N), c(N);
    for (ll i = 0; i < N; i++) {
        cin >> a[i] >> b[i] >> c[i];
    }

    vector<vector<ll>> dp(N + 1, vector<ll>(3, 0));
    for (ll i = 0; i < N; i++) {
        dp[i + 1][0] = max(dp[i + 1][0], max(dp[i][1], dp[i][2]) + a[i]);
        dp[i + 1][1] = max(dp[i + 1][1], max(dp[i][2], dp[i][0]) + b[i]);
        dp[i + 1][2] = max(dp[i + 1][2], max(dp[i][0], dp[i][1]) + c[i]);
    }

    cout << max({dp[N][0], dp[N][1], dp[N][2]}) << endl;
}

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

int main()
{
	long long a, b, c, k;
	cin >> a >> b >> c >> k;
	long long ans = 0;

	if (a >= k)
	{
		cout << k << "\n";
		return 0;
	}

	ans += a;
	k -= a;

	if (b >= k)
	{
		cout << ans << "\n";
		return 0;
	}

	k -= b;

	if (c >= k)
	{
		cout << ans - k << "\n";
		return 0;
	}

}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...) 0
#endif

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

    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    vector<set<int>> g(n);
    vector<int> a(n), b(n);
    rep(i, 0, m) {
        int x, y;
        cin >> x >> y;
        x--, y--;
        g[x].insert(y);
        g[y].insert(x);
    }
    set<int> st;
    rep(i, 0, n) {
        for (int to : g[i]) {
            if (s[to] == 'A')
                a[i]++;
            else
                b[i]++;
        }
        if (a[i] * b[i] == 0) st.insert(i);
    }
    int sz = n;
    while (st.size()) {
        int v = *st.begin();
        st.erase(st.begin());
        sz--;
        for (int to : g[v]) {
            if (to == v) continue;
            g[to].erase(v);
            if (s[v] == 'A')
                a[to]--;
            else
                b[to]--;
            if (a[to] * b[to] == 0) st.insert(to);
        }
    }
    cout << (sz ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 34000
K, N = map(int, input().split())
A = list(map(int, input().split()))

max_dist = 0
for i in range(len(A)):
    if i != len(A) - 1:
        dist = A[i + 1] - A[i]
    else:
        dist = K - A[i] + A[0]
    if dist > max_dist:
        max_dist = dist
print(K - max_dist)

Measured memory_bytes: 26444
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0351

#include<bits/stdc++.h>
const int N = 1505;
const int inf = 1e9;
using namespace std;

typedef pair <int, int> ii;
vector <ii> adj[N];
int n, m, d[N][N], ans, visit[N], f[N], ck[N];

void dijkstra(int S){
    for (int i = 1; i <= n; i++) d[S][i] = inf; d[S][S] = 0;
    priority_queue <ii, vector <ii>, greater<ii> > mq; mq.push(ii(d[S][S], S));
    while (mq.size()){
        ii z = mq.top(); mq.pop();
        int u = z.second, val = z.first;
        if (val != d[S][u]) continue;
        ans = max(ans, val);
        for (int i = 0; i < adj[u].size(); i++){
            int v = adj[u][i].first, cost = adj[u][i].second;
            if (d[S][v] > d[S][u] + cost){
                d[S][v] = d[S][u] + cost;
                mq.push(ii(d[S][v], v));
            }
        }
    }
}

void dfs(int u, int root){
    if (visit[u]) return;
    visit[u] = true;
    f[u] = d[root][u];
    for (int i = 0; i < adj[u].size(); i++){
        int v = adj[u][i].first, cost = adj[u][i].second;
        if (d[root][v] == d[root][u] + cost){
            dfs(v, root); f[u] = max(f[u], f[v]);
        }
    }
    if (f[u] == ans) ck[u] = 1;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= m; i++){
        int u, v, d; cin >> u >> v >> d;
        adj[u].push_back(ii(v, d));
        adj[v].push_back(ii(u, d));
    }
    for (int i = 1; i <= n; i++) dijkstra(i);
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= n; j++) visit[j] = 0;
        dfs(i, i);
    }
    int cnt = 0; for (int i = 1; i <= n; i++) if (!ck[i]) cnt++;
    cout << cnt << "\n";
    for (int i = 1; i <= n; i++) if (!ck[i]) cout << i << "\n";
}



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

using namespace std;

int main() {
    int k, s, count = 0;
    int x, y;
    cin >> k >> s;
    for (x = 0; x < k+1; x++) {
        for (y = 0; y < k+1; y++) {
            if (s-x-y >=0 && s-x-y <=k) count++;
        }
    }
    cout << count << endl;
    return 0;
}


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

int main(void)
{
    int n,r,min,max=INT_MIN,i;
    scanf("%d%d",&n,&r);
    min=r;
    for(i=1;i<n;i++){
        scanf("%d",&r);
        if(r-min>max)max=r-min;
        if(min>r)min=r;
    }
    printf("%d\n",max);
    return 0;
}


Measured memory_bytes: 2120
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
  string s="abcdefghijklmnopqrstuvwxyz";
  ll n,d;
  cin>>n;
  string ans;
  while(n>0)
  {
  	d=n%26;
    n=n/26;
    if(d==0)
    {
      ans+=s[25];
      n=n-1;
    }
    else
    {
      ans+=s[d-1];
    }
  }
  reverse(ans.begin(),ans.end());
  cout<<ans<<endl;
}


Measured memory_bytes: 3628
/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.

*/
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;
typedef long long ll;

int mod = 1000000007;
ll dp[100005];;

ll gcd(long long a,long long b){

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

bool compare(pair<int,int>p1, pair<int,int>p2){

  return p1.second > p2.second;
 }

 int main(){

  int a[3];

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

 sort(a,a+3);
  long long sum =0;

 for(int i=0;i<2;i++){
    sum += a[i+1]-a[i];
 }

 cout<<sum<<endl;

 return 0;
 }

Measured memory_bytes: 3580
#include <iostream>

using namespace std;



int main() {
	int a, b;

	cin >> a >> b;

	int coins = 0;

	for (int i = 0; i < 2; i++)
	{
		if (a >= b)
		{
			coins += a;
			a -= 1;
		}
		else
		{
			coins += b;
			b -= 1;
		}
	}

	cout << coins << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define rep1(i,n)for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=(int)(n)-1;0<=i;i--)
#define rrep1(i,n) for(int i=(int)(n);1<=i;i--)

#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define endl "\n"

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

typedef long long lint;

using namespace std;
int main(){
	int x;
	cin>>x;
	cout<<(x<1200?"ABC":"ARC")<<endl;
}


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

int main(void) {
    int A,B,C;cin>>A>>B>>C;
    for (int i = 1; i < B; i++) {
        if ((i * A) % B == C) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

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

#define pb push_back
#define mp make_pair
#define fst first
#define snd second

#define fr(i,n) 	for(int i=0;i<n;i++)
#define frr(i,n)	for(int i=1;i<=n;i++)
#define pv(x, n)    fr(iii, n) printf("%d%c", x[iii], " \n"[iii==n-1])
#define pvv(x, n)    frr(iii, n) printf("%d%c", x[iii], " \n"[iii==n])
#define vp(v)        pv(v, v.size()) 


#define ms(x,i)	memset(x,i,sizeof(x))
#define dbg(x)	cout << #x << " = " << x << endl
#define all(x)	x.begin(),x.end()
#define otp(x) cout << x << endl;
#define rvr(x) int x; scanf("%d", &x)
#define gnl cout << endl
#define olar cout << "olar" << endl
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long int ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;

const int INF = 0x3f3f3f3f;
const ll llINF = 0x3f3f3f3f3f3f3f;

int main(){
    int x, y, a, b, c; scanf("%d%d%d%d%d", &x, &y, &a, &b, &c);
    vi red, green, white;
    fr(i, a){
        rvr(aa);
        red.pb(aa);
    }
    fr(i, b){
        rvr(bb);
        green.pb(bb);
    }
    fr(i, c){
        rvr(cc);
        white.pb(cc);
    }
    sort(all(red));
    reverse(all(red));
    sort(all(green));
    reverse(all(green));
    sort(all(white));
    reverse(all(white));
    while(red.size() > x){
        red.pop_back();
    }
    while(green.size() > y){
        green.pop_back();
    }
    reverse(all(red));
    reverse(all(green));
    ll ans = 0;
    fr(i, x){
        ans += (ll)(red[i]);
    }
    fr(i, y) ans += (ll)(green[i]);
    int i = 0, j = 0, k = 0;
    bool end = false;
    while(i < x && j < y && k < c){
        if(red[i] < green[j]){
            if(white[k] > red[i]){
                ans += (ll)(white[k] - red[i]);
                k++;
                i++;
            }
            else{
                end = true;
                break;
            }
        }
        else{
            if(white[k] > green[j]){
                ans += (ll)(white[k] - green[j]);
                k++;
                j++;
            }
            else{
                end = true;
                break;
            }
        }
    }
    while(!end && i < x && k < c && white[k] > red[i]){
        ans += (ll)(white[k] - red[i]);
        k++;
        i++;
    }
    while(!end && j < y && k < c && white[k] > green[j]){
        ans += (ll)(white[k] - green[j]);
        k++;
        j++;
    }
    printf("%lld\n", ans);
}


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

int main(void){

	int h,i,j,m,n;
	string ch,left,right;

while(1)
{
	cin >>ch;
if(ch == "-") break;
	cin >>m;
		for(i=0;i<m;i++){
			cin >>n;
		  	left = ch.substr(0,n);
			right =ch.substr(n,ch.size());
			ch = right + left;
			}
cout <<ch <<"\n";
 	}

return 0;
}

Measured memory_bytes: 1208
#include <iostream>

using namespace std;

int main() {
  int x, y;
  while (1) {
    cin >> x >> y;
    if (!x && !y) break;
    if (x < y) {
      cout << x << " " << y << endl;
    } else {
      cout << y << " " << x << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0;i<(ll)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
const ll mod=1e9+7;
const ll INF = 1e9;

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

bool is_prime(ll x){
    if(x==1) return false;
    for(ll i=2; i*i<=x;i++){
        if(x%i == 0) return false;
    }
    return true;
}

ll f(ll n){
    if(n==1) return 1;
    return (n)*f(n-1);
}

int main(){
    fast_io
    
    int n;
    cin>>n;
    vector<int> x(n), y(n), v(n);
    rep(i,n) {
        cin>>x[i]>>y[i];
        v[i]=i;
    }
    double L=0;
    ll cnt=0;
    do{
        for(int i=0;i<n-1;i++){
            L+=sqrt((x[v[i]]-x[v[i+1]])*(x[v[i]]-x[v[i+1]]) + (y[v[i]]-y[v[i+1]])*(y[v[i]]-y[v[i+1]]));
        }
    }while(next_permutation(v.begin(), v.end()));
    cnt=f(n);
    double ans=(double)L/(double)cnt;
    cout<<fixed<<setprecision(10)<<ans<<endl;

    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
typedef pair<double,double> point;
const ll MAX = 200000;
constexpr ll nx[8] = {1,0,-1,0,1,-1,1,-1};
constexpr ll ny[8] = {0,1,0,-1,1,1,-1,-1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b;
    cin >> a >> b;
    PRINT(a*b);
}


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

int main()
{
    int flag = -1;
    string S, T;
    char ss;
    cin >> S;
    cin >> T;

    for (int j = 0; j < S.size();j++){
        if (S == T)
        {
            flag = 0;
        }

        ss = S.at(S.size() - 1);
        for (int i = S.size(); i >1;i--){
            //
            S.at(i-1) = S.at(i - 2);
        }
        S.at(0) = ss;
    }


    if(flag==0){
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    


}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Map;
import java.util.HashMap;

public class Main {

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

        Scanner s = new Scanner(System.in);

        while (true) {

            int n = s.nextInt();

            if(n == 0) break;

            Map<String, String> m = new HashMap<String, String>(n);
            for (int i = 0; i < n; i++) {
                m.put(s.next(), s.next());
            }

            n = s.nextInt();
            StringBuffer sb = new StringBuffer();
            for (int i = 0; i < n; i++) {
                String str = s.next();
                sb.append(m.containsKey(str) ? m.get(str) : str);
            }
            System.out.println(sb.toString());
        }


    }

}

Measured memory_bytes: 67848
#include<stdio.h>
int main()
{
    int a[100][100]={0},b[100]={0},c[100]={0};
	int m,n;
	scanf("%d %d",&n,&m);
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			scanf("%d",&a[i][j]);
		}
	}
	for(int i=0;i<m;i++)
	{
		scanf("%d",&b[i]);
	}
	
    for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			
			c[i]+=a[i][j]*b[j];
			
		}
	}
	for (int i=0;i<n;i++) 
    {
        printf("%d\n",c[i]);
    }
  return 0;

}

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

vector<int>to[200005];
vector<int>ans;
void dfs(int v ,int p=-1){
	for(int u:to[v]){
		if(u==p)continue;
		ans.at(u)+=ans.at(v);
		dfs(u,v);
	}
}

int main() {
	int n,q;
  cin >> n >> q;
  for(int i=0;i<n-1;i++){
		int a,b;
  	cin >> a >> b;
  	--a,--b;
  	to[a].push_back(b);
  	to[b].push_back(a);
  } 	
	ans.resize(n);
	for(int i=0;i<q;i++){
		int p,x;
		cin >> p >> x;
		--p;
		ans.at(p)+=x;
	}
	dfs(0);
	for(int i=0;i<n;i++) cout << ans.at(i) << " ";
}


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

int main(){
  long long n,ans;
  cin >> n;
  ans=0;
  rep(i,n){
    ans += (i+1)*(1+n/(i+1))*(n/(i+1))/2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3512
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

vector<u64> L(1001, 0);

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

    int N;
    cin >> N;

    int l;
    int lmax = 0;
    rep (i, N)
    {
        cin >> l;
        ++L[l];
        lmax = MAX(lmax, l);
    }

    u64 ans = 0;
    for (int i = 1; i <= lmax; ++i)
    {
        if  (L[i]  == 0) continue;
        for (int a = 1; a <= i; ++a)
        {
            for (int b = a; b <= i; ++b)
            {
                if (L[a] == 0 || L[b] == 0 || a + b <= i) continue;
                if (a == i && b != i) ans += L[i] * MAX(L[a] - 1, 0) * L[b] / 2;
                else if (b == i && a != i) ans += L[i] * L[a] * MAX(L[b] - 1, 0) / 2;
                else if (a == b && a != i) ans += L[i] * L[a] * MAX(L[b] - 1, 0) / 2;
                else if (a == b && a == i) ans += L[i] * MAX(L[a] - 1, 0) * MAX(L[b] - 2, 0) / 6;
                else ans += L[i] * L[a] * L[b];
            }
        }
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod =1000000007;
ll  dp[25][1<<22];
int a[25][25];

ll fun(int m,int w,int n){
    if(m==n){
        if(w==0)return 1;
        else return 0;
    }
    if(dp[m][w]>-1)return dp[m][w];
    ll ans=0;
    for(int i=0; i<n; i++){
        bool avl=((1<<i)&(w));
        if(avl && a[m][i]==1){
            ans+=fun(m+1,((1<<i)^(w)),n);
            ans%=mod;
        }
    }
    return dp[m][w]=ans;
}
void solve()
{
    int n;
    cin>>n;
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            cin>>a[i][j];
        }
    }
    memset(dp,-1,sizeof dp);
    fun(0,(1<<n)-1,n);
    cout<<dp[0][(1<<n)-1];
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int t;
    t=1;
    while(t--){
        solve();
        cout<<endl;
    }
}


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

signed main(){
    string s;
    cin >> s;
    REP(i,s.size()){
        if(i % 2 == 0 && s[i] == 'L'){
            cout << "No" << endl;
            return 0;
        }else if(i % 2 == 1 && s[i] == 'R'){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

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

int main() {
	ll k;
	cin >> k;
	ll p = k%50LL;
	ll m = k/50LL + 49LL - p;
	ll n = 50LL;
	vector<ll> a(n, m);
	int cnt = 1;
	const ll mx = 800;
	a[0] +=  min(mx, n * p);
	if (n * p - mx * 1 > 0) {
		a[1] += min(mx, n * p - mx * 1);
	}
	if (n * p - mx * 2 > 0) {
		a[2] += min(mx, n * p - mx * 2);
	}
	if (n * p - mx * 3 > 0) {
		a[3] += min(mx, n * p - mx * 3);
	}
	if (n * p - mx * 4 > 0) {
		a[3] += min(mx, n * p - mx * 4);
	}
	
	cout << n << endl;
	rep(i, n) cout << a[i] << ((i == n-1) ? '\n' : ' ');
	return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

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

		int money = sc.nextInt();

		sc.close();

		int happy = 0;

		if (money / 500 > 0) {
			happy += 1000 * (money / 500);
			money -= 500 * (money / 500);
		}
		if (money / 5 > 0) {
			happy += 5 * (money / 5);
			money -= 5 * (money / 5);
		}

		System.out.print(happy);
	}

}


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

// cl /EHsc xxxx.c
int main(int arc, char *argv[])
{
	int x, y;
	
	while (1)
	{
		scanf("%d %d", &x, &y);
		if (x == 0 && y == 0)
		{
			break;
		}
		if (x < y) {
			printf("%d %d\n", x, y);
		} else {
			printf("%d %d\n", y, x);
		}
	}
	
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
# define ll int64_t
# define str string
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define PI 3.141592653589793
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl
using namespace std;



#define INF 2000000000
#define MAX_V 10



bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<ll,ll> a,pair<ll,ll> b){
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll modpow(ll a,ll n,ll mod1) {
    ll res=1;
    while(n>0){
        if(n&1) res=res*a%mod1;
        a = a*a%mod1;
        n >>= 1;
    }
    return res;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

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

ll lcm(ll a,ll b){
   return a/gcd(a,b)*b;
}
const ll MAX = 5100000;
const ll MOD = 1000000007;
 
ll fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

using graph = vector<vector<ll>>;
pair<pair<ll,ll>,ll> p[100010];

vec<ll> dp;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll h,w,n;
    cin>>h>>w>>n;
    vector<ll> sum,a(n);
    rep(i,n) {
        cin>>a[i];
        rep(j,a[i]) sum.pb(i+1);
    }
    graph grid(h,vector<ll>(w));
    ll num=0;
    rep(i,h){
        if(i%2==0) rep(j,w){
            grid[i][j]=sum[num];
            num++;
        }else rep(j,w){
            grid[i][w-1-j]=sum[num];
            num++;
        }
    }
    
    rep(i,h){
        rep(j,w){
            if(j!=w-1) cout<<grid[i][j]<<" ";
            else cout<<grid[i][j];
        }
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int a,b,c,flag=0;
scanf("%d%d%d",&a,&b,&c);
if(a==5&&b==5&&c==7)
flag=1;
if(a==5&&b==7&&c==5)
flag=1;
if(a==7&&b==5&&c==5)
flag=1;
if(flag==1)
printf("YES");
else
printf("NO");

return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
color=[0]*9
for i in a:
    if i//400<=7:
        color[i//400]+=1
    else:
        color[8]+=1
m=8-color[:8].count(0)
M=m+color[8]
if m==0:
    m=1
print(m,M)

Measured memory_bytes: 3064