akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

vector<string> board(8);
vector<int> dx={0,1,1,1,0,-1,-1,-1};
vector<int> dy={1,1,0,-1,-1,-1,0,1};

int angles_check(int x, int y, string name){
    char my_dessert;
    if(name=="mami"){
        my_dessert='o';
    }else{
        my_dessert='x';
    }
    int ret=0;
    for(int i=0;i<8;i++){
        int step=1,tmp_ret=0;
        while(1){
            int now_x = x+dx[i]*step;
            int now_y = y+dy[i]*step;

            //境界判定
            if(!(0<=now_x && now_x<8 && 0<=now_y && now_y<8)){
                tmp_ret=0;
                break;
            }
            
            if(board[now_x][now_y]==my_dessert){
                break;
            }else if(board[now_x][now_y]=='.'){
                tmp_ret=0;
                break;
            }
            tmp_ret++;
            step++;
        }
        ret+=tmp_ret;
    }
    return ret;
}

void replace_board(int x, int y, string name){
    char my_dessert;
    if(name=="mami"){
        my_dessert='o';
    }else{
        my_dessert='x';
    }

    board[x][y]=my_dessert;

    for(int i=0;i<8;i++){
        int step=1;
        bool flag=false;
        while(1){
            int now_x = x+dx[i]*step;
            int now_y = y+dy[i]*step;
            //境界判定
            if(!(0<=now_x && now_x<8 && 0<=now_y && now_y<8))break;
            if(board[now_x][now_y]==my_dessert){
                flag=true;
                break;
            }else if(board[now_x][now_y]=='.'){
                break;
            }
            step++;
        }
        if(flag) if(step>=2) for(int k=1;k<step;k++) board[x+dx[i]*k][y+dy[i]*k]=my_dessert;
    }
}

int board_check(string name){
    vector<vector<int>> max_check(8,vector<int>(8,0));
    int get_num,maxi=0;
    for(int i=0;i<8;i++){
        for(int j=0;j<8;j++){
            if(board[i][j]!='.')continue;
            get_num=angles_check(i,j,name);
            max_check[i][j]=get_num;
            maxi=max(maxi,get_num);
        }
    }
    if(name=="mami"){
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                if(maxi!=0 && maxi==max_check[i][j]){
                    replace_board(i,j,name);
                    goto A;
                }
            }
        }
    }else{
        for(int i=7;i>=0;i--){
            for(int j=7;j>=0;j--){
                if(maxi!=0 && maxi==max_check[i][j]){
                    replace_board(i,j,name);
                    goto A;
                }
            }
        }
    }
    A:
    return maxi;
}

int main(){
    for(int i=0;i<8;i++) cin >> board[i];
    string name="mami";
    int pass=0;
    while(1){
        if(pass==2)break;
        if(name=="mami"){
            if(!board_check(name)){
                pass++;
            }else{
                pass=0;
            }
            name="charlotte";
        }else{
            if(!board_check(name)){
                pass++;
            }else{
                pass=0;
            }
            name="mami";
        }
    }

    for(int i=0;i<8;i++) cout << board[i] <<endl;
}


Measured memory_bytes: 3236
//
//	Created by shamim_nik
//

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,
		tree_order_statistics_node_update> indexed_set;

#define br printf("\n")

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

//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	string str;
	cin >> str;
	if (str == "ABC") {
		cout << "ARC\n";
	} else {
		cout << "ABC\n";
	}
	return 0;
}

Measured memory_bytes: 3624
#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 A, B, C, D;
    cin >> A >> B >> C >> D;
    while(true) {
        C -= B;
        if (C <= 0) {
            cout << "Yes\n";
            return 0;
        }
        A -= D;
        if (A <= 0) {
            cout << "No\n";
            return 0;
        }
    }
}


Measured memory_bytes: 3636
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define rep(i, n) for(int i=0; i<n; ++i)
typedef long long ll;

#define MAX_N 100000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

//--------------------------

string s, t;

int main() {

  int cnt = 0;

  cin >> s >> t;

  rep(i, 3) {
    if(s[i]==t[i]) ++cnt;
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
A = list(map(int, input().split()))

k_bin = "{:040b}".format(k)
A_bin = list(map(lambda x: '{:040b}'.format(x), A))
dp = [[0]*2 for _ in range(41)]
for i, col in enumerate(zip(*A_bin)):
    zero_cnt = col.count('0')
    one_cnt = n-zero_cnt

    p = 40-i-1

    if dp[i][0] != 0:
        dp[i+1][0] = dp[i][0]+max(zero_cnt, one_cnt)*2**p

    if k_bin[i] == '0':
        dp[i+1][1] = dp[i][1]+one_cnt*2**p
    else:
        dp[i+1][0] = max(dp[i+1][0], dp[i][1]+one_cnt*2**p)
        dp[i+1][1] = dp[i][1]+zero_cnt*2**p

print(max(dp[-1]))

Measured memory_bytes: 27972
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int coin[]={500,100,50,10,5,1};
		while(true){	
			int x,ans = 0;
				x=cin.nextInt();
					if(x==0){
						break;
					}
				x=1000-x;
					for(int c: coin){
						ans=ans+x/c;
						x=x%c;
					}
				System.out.println(ans);
		}
	}
}

	

Measured memory_bytes: 17168
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
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; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class CBuildStairs {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n; cin >> n;
      vector<int> h(n);
      rep(i, n) {
        cin >> h[i];
      }
      reverse(all(h));
      rep(i, n-1) {
        if (h[i] < h[i+1]) {
          h[i+1]--;
        }
        if (h[i] < h[i+1]) {
          cout << "No" <<endl;
          return;
        }
      }
      cout << "Yes" << endl;
    }
};

signed main() {
  CBuildStairs solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

#define LB(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define UB(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld; 

ll mod = 1e9 + 7;

#define each(a,x) for( auto &a:(x))
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rep2(i, l, r) for (ll i = (l); i < (r); i++)
#define rep2r(i, l, r) for (ll i = (r) - 1; i >= (l); i--)
#define range(a) a.begin(), a.end()

int main()
{
	fastio();
	ll n;
	cin>>n;
	double p = n;
	// ll a = 100;
	// cout<<a*1.08;
	n = n*100;
	if(n % 108 == 0)
		cout<<n/108<<endl;
	else
	{	
		n = n/100;
		double k = ceil(p / 1.08);
		
	
			if(floor(k*1.08) == n)
			{
				cout<<k<<endl;
				return 0;
			}
		

		cout<<":(\n";
		return 0;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define FOR(i,a,b) for(int i=(a);i<=(b);++i) 
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i) 
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>0;--i)
#define CI cin>> 
#define CO cout<<
#define EN <<endl 
#define all(x) (x).begin(),(x).end() 
#define asn ans
using namespace std;
template <typename T> istream & operator >> (istream & is, vector<T> & vec) { for (T& x : vec) is >> x; 	return is; }
using ll = long long;

int main() {
	int n, q; CI n >> q;
	string s; CI s;
	int ans[200000] = {};

	for (int i = 0; i < n; i++) {
		if (s[i] == 'A' and s[i + 1] == 'C') {
			ans[i + 1] = ans[i] + 1;
		}
		else {
			ans[i + 1] = ans[i];
		}
	}
	vector<pair<int, int>> a(q);
	REP(i,q) {
		CI a[i].first >> a[i].second;
	}
	REP(i, q) {
		CO ans[a[i].second - 1] - ans[a[i].first - 1] EN;
	}
}

Measured memory_bytes: 2560
// #pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vec>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define endl "\n"
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))
#define MM " "
using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}
const ll mod=1e9+7;
ll dp[200][100000];
main(){
  int n=in(),k=in();
  vec d;
  for(int i=1;i*i<=n;i++){
    d.pb(i);
    if(i!=n/i)d.pb(n/i);
  }
  int D=d.size();
  rep(i,D)dp[0][i]=1;
  sort(all(d));
  rep(ii,k){
    int pre=0;
    rep(i,D){
      dp[ii+1][D-1-i]+=dp[ii][i]*(d[i]-pre)%mod;
      pre=d[i];
    }
    rep3(i,D-2,0){
      dp[ii+1][i]=(dp[ii+1][i+1]+dp[ii+1][i])%mod;
    }
  }
  cout<<dp[k][0]<<endl;
}


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


#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}

ll gcd(ll x, ll y){ return y? gcd(y, x%y): x; }
ll lcm(ll x, ll y){ return (x  / gcd(x, y) * y ); }

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	ll ans = 1;
	rep(i, n){
		ll t; cin >>t;
		ans = lcm(ans, t);
	}
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int P=998244353;
int main(){
	int N;
	cin >> N;
	N %= 10;
	if(N==3) cout << "bon" << endl;
	else if(N<2 || N==6 || N==8) cout << "pon" << endl;
	else cout << "hon" << endl;
	return 0;
}


Measured memory_bytes: 3636
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int 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;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//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 SIZE(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) 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(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

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

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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




int main(int argc, char *argv[]){
    int n;
    cin>>n;
    string s[50];    
    REP(i,n){
        cin>>s[i];
    }
    
    unsigned int c[26],d[26];
    REP(j,26) c[j]=0;
    REP(j,SIZE(s[0])){
        c[s[0][j]-'a']++;
    }

    REP(j,26) d[j]=c[j];

    FOR(i,1,n){
        REP(j,26) c[j]=0;
        REP(j,SIZE(s[i])){
            c[s[i][j]-'a']++;
        }
        REP(j,26) d[j]=min(d[j],c[j]);
    }
    
    REP(i,26){
        REP(j,d[i])
            cout<<char('a'+i);
    }
    cout<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <cmath>
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, s, n) for (ll i = s; i < (n); i++)
using namespace std;
using P = pair<int, int>;

vector<int> x{1, 0, -1, 0};
vector<int> y{0, 1, 0, -1};
int main(){
  int h, w, ch, cw, dh, dw;
  cin >> h >> w >> ch >> cw >> dh >> dw;
  ch--, cw--, dh--, dw--;
  vector<string> s(h);
  vector<vector<int>> warp(h, vector<int>(w, -1));
  rep(i, h) cin >> s[i];
  warp[ch][cw] = 0;
  priority_queue<P, vector<P>, greater<P>> que;
  que.push(P(0, ch+cw*h));
  int ans = -1;
  while(!que.empty()){
    P now = que.top();
    int num = now.first;
    int nh = now.second % h;
    int nw = now.second / h;
    que.pop();
    if (nh == dh && nw == dw){
      ans = num;
      break;
    }
    rep(i, 4){
      int xh = nh + x[i];
      int xw = nw + y[i];
      if (xh < 0 || xh >= h || xw < 0 || xw >= w) continue;
      if (s[xh][xw] == '#') continue;
      if (warp[xh][xw] != -1 && warp[xh][xw] <= warp[nh][nw]) continue;
      warp[xh][xw] = warp[nh][nw];
      que.push(P(num, xh+xw*h));
    }
    rep2(i, -2, 3)rep2(j, -2, 3){
      int xh = nh + i;
      int xw = nw + j;
      if (xh < 0 || xh >= h || xw < 0 || xw >= w) continue;
      if (s[xh][xw] == '#') continue;
      if (warp[xh][xw] != -1 && warp[xh][xw] <= warp[nh][nw]+1) continue;
      warp[xh][xw] = warp[nh][nw] + 1;
      que.push(P(num+1, xh+xw*h));
    }
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 9488
import java.util.Scanner;

class Main{
  public static void main(String args[]){
    int i,j,k,n,b,f,r,v;
    int [][] one = new int[3][10];
    int [][] two = new int[3][10];
    int [][] three = new int[3][10];
    int [][] four = new int[3][10];
    Scanner sc = new Scanner(System.in);
    n = sc.nextInt();
    for(i = 0;i < 3;i++){
      for(j = 0;j < 10;j++){
        one[i][j] = 0;
        two[i][j] = 0;
        three[i][j] = 0;
        four[i][j]  = 0;
      }
    }
    for(i = 0;i < n;i++){
      b = sc.nextInt();
      f = sc.nextInt();
      r = sc.nextInt();
      v = sc.nextInt();
      if(b == 1){
        one[f - 1][r - 1] += v;
      }
      else if(b == 2){
        two[f - 1][r - 1] += v;
      }
      else if(b == 3){
        three[f - 1][r - 1] += v;
      }
      else if(b == 4){
        four[f - 1][r - 1] += v;
      }
    }
    for(i = 0;i < 3;i++){
      for(j = 0;j < 10;j++){
          System.out.print(" " + one[i][j]);
      }
      System.out.println();
    }
    System.out.println("####################");

    for(i = 0;i < 3;i++){
      for(j = 0;j < 10;j++){

          System.out.print(" " + two[i][j]);
      }
      System.out.println();
    }

    System.out.println("####################");

    for(i = 0;i < 3;i++){
      for(j = 0;j < 10;j++){
          System.out.print(" " + three[i][j]);
      }
      System.out.println();
    }
    System.out.println("####################");

    for(i = 0;i < 3;i++){
      for(j = 0;j < 10;j++){
          System.out.print(" " + four[i][j]);
      }
      System.out.println();
    }
  }
}

Measured memory_bytes: 29444
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define MOD (long long)1000000007
#define INF (long long)998244353
using namespace std;

int main(void){
    int m,d;
    cin >> m >> d;
    int ans=0;
    for(int i=1; i<=m; i++){
        for(int j=1; j<=d; j++){
            if(j%10>=2 && j/10>=2 && (j/10)*(j%10)==i)ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
using namespace std;
typedef long long ll;
static const ll MOD = 1e9 + 7;
static const ll INF = 1e25;

static const int MAX = 4;

ll a[100001] = {};
int main() {
	ll n, t; cin >> n >> t;
	rep(i, 0, n) cin >> a[i];

	ll minV = INF;
	ll length = 0;
	ll cnt = 0;
	rep(i, 0, n) {
		if (minV > a[i]) {
			minV = a[i];
		}
		ll v = a[i] - minV;

		if (length < v) {
			length = v;
			cnt = 1;
		}
		else if (length == v)cnt++;
	}
	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <math.h>

struct Point{
  double x,y;
};

void koch(int n, Point a,Point b){
  if(n == 0) return;
  Point s,t,u;
  double th = M_PI * 60.0 / 180.0;

  s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
  s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
  t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
  t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
  u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
  u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

  koch(n-1,a,s);
  printf("%.8f %.8f\n",s.x,s.y);
  koch(n-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  koch(n-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  koch(n-1,t,b);
}

int main(){
  Point a,b;
  int n;

  scanf("%d",&n);

  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;

  printf("%.8f %.8f\n",a.x,a.y);
  koch(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);

  return 0;
}



Measured memory_bytes: 2724
#include <iostream>
#include <string>
#include <vector>
#include <map>
using ll=long long;
using namespace std;

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

    int ma=1e6+1;
    vector<int> table(ma,1);
    for(int i=2;i<ma;i++){
        for(int j=i;j<ma;j+=i){
            if(table[j]==1){
                table[j]=i;
            }
        }
    }

    ll ans=0;

    for(int i=1;i<N;i++){
        int tmp=i;
        map<int,int> m;
        while(tmp!=1){
            m[table[tmp]]++;
            tmp=tmp/table[tmp];
        }
        ll subans=1;
        for(auto p:m){
            subans*=(p.second+1);
        }
        ans+=subans;
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 7216
# 入力
my $n = <STDIN>;
my @array = split(/ /, <STDIN>);
 
# 平均値 $y を決定
my $sum = 0;
for my $ai (@array) {
    $sum += $ai;
}
my $y = do {
    if ($sum < 0) {
        int($sum / $n - 0.5);
    }
    else {
        int($sum / $n + 0.5);
    }
};
 
# コストを計算
my $cost = 0;
for my $ai (@array) {
    $cost += ($ai - $y) ** 2;
}
 
# 出力
print $cost, "\n";

Measured memory_bytes: 512
def gcd(x, y):
  if y > x:
    x, y = y, x
  if y == 0:
    return x
  return gcd(y, x % y)

def lcm(x, y):
  if y > x:
    x, y = y, x
  return x * y / gcd(x, y)

N = input()
lcm_num = 1
for _ in range(N):
  t = input()
  lcm_num = lcm(lcm_num, t)

print lcm_num


Measured memory_bytes: 2568
N=int(input())
A=list(map(int,input().split()))
d=dict()
for i in range(N):
    if A[i] not in d:
        d[A[i]]=0
    d[A[i]]+=1
x=sum(x*(x-1)//2 for x in d.values())
for i in range(N):
    y=d[A[i]]
    print(x-y*(y-1)//2+(y-1)*(y-2)//2)


Measured memory_bytes: 32252
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <bitset>
#include <cstdlib>
#include <cmath>
#include <set>
#include <list>
#include <deque>
#include <map>
#include <queue>
#include <fstream>
#include <cassert>
#include <cmath>
#include <sstream>
#include <time.h>
#include <complex>
#include <iomanip>
//#include <unordered_set>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef pair<int,int> ii;
typedef pair<double,double> dd;
typedef pair<char,char> cc;
typedef vector<ii> vii;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l4;
const double eps = 0.005;
const int maxn = 510;
const ll mod = 1e9+7;
const int INF = 1e9;
const double pi = acos(-1);
typedef double Matrix[maxn][maxn];
int n;
int M[maxn][maxn];
int H,W,h,w;
int main() {
    scanf("%d%d%d%d",&H,&W,&h,&w);
    int tmp = -(h*w-1)*1000-1;
    for (int i = h-1; i < H; i += h) {
        for (int j = w-1; j < W; j+= w) {
            M[i][j] = tmp;
        }
    }
    int ans = 0;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (M[i][j]) {
                ans += M[i][j];
            } else {
                M[i][j] = 1000;
                ans += 1000;
            }
        }
    }
    if (ans > 0) {
        printf("Yes\n");
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                printf("%d ",M[i][j]);
            }
            printf("\n");
        }
    } else {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>; // グラフ型
typedef long long ll;
#define _GLIBCXX_DEBUG
//#define pai 3.14159265

 // 深さ優先探索
vector<bool> seen;
int dfs(const Graph &G, ll v) {
    seen[v] = true; // v を訪問済にする
    int score = 0; 

    // v から行ける各頂点 next_v について
    for (auto next_v : G[v]) { 
        if (seen[next_v]) continue; // next_v が探索済だったらスルー

        // 負荷さ優先探索中の処理



        dfs(G, next_v); // 再帰的に探索, 毎回mat渡してええの？
    }
    return score;
} 

/*
//桁数の計算
ll keta(ll num){
  ll ans= 0 ;
  ll rem;

  for (ll i = 4; i >= 0 ; i--){
    rem = pow(10,i);
    ans += (num / rem); 
    num = num % rem;
  }
  return ans;
}
*/


int main() {
  int A, B, H, M;
  long double tha, thb, dis;
  cin >> A >> B >> H >> M;
  const double PI=3.14159265358979323846264338327950L;

  long double time = (long double)H * 60 + (long double)M;
  tha = 360.0 - (time /2) + 90.0;
  thb =360.0 - ((long double)M * 6) + 90.0 ;

/*   if (tha > 360) tha -= 360;
  if (thb > 360) thb -= 360; */

  long double rada = tha * PI / 180.0;
  long double radb = thb * PI / 180.0;


  dis = pow(((long double)A * cos(rada) - (long double)B * cos(radb)), 2) + pow(((long double)A * sin(rada) - (long double)B * sin(radb)), 2);
  cout << setprecision(18) << sqrt(dis)  << endl; 
  //cout << tha << endl;
  //cout << thb << endl;
  //cout << rada << endl;
  //cout << radb << endl;
  //cout << cos(PI/2) << endl;


  return 0;
}

Measured memory_bytes: 4140
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    a,b = map(int,ipt().split())
    if a == 1 and b == 1:
        print(1,2)
        print(".#")
        exit()
    print(100,100)
    a -= 1
    b -= 1
    ni = 0
    while a >= 50:
        print(".#"*50)
        print("#"*100)
        ni += 2
        a -= 50
    print(".#"*a+"##"*(50-a))
    print("#"*100)
    ni += 2
    for i in range(50-ni):
        print("#"*100)
    ni = 0
    while b >= 50:
        print("."*100)
        print(".#"*50)
        ni += 2
        b -= 50
    print("."*100)
    print(".#"*b+".."*(50-b))
    ni += 2
    for i in range(50-ni):
        print("."*100)



    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 38636
def solve():
  N = int(input())
  lines = [input().split() for i in range(N)]
  count = 0
  for d,e in lines:
    if d==e:
      count += 1
      if count>=3:
        print("Yes")
        return
    else:
      count = 0
  print("No")
  return

solve()


Measured memory_bytes: 9052
'''
https://atcoder.jp/contests/abc075/tasks/abc075_c?lang=ja
深さ優先探索でも解ける
'''
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

    class UnionFind():
        #n個の要素を番号0~n-1で管理する
        #parents:要素の親(1つ上), 要素が根の場合サイズを表す
        def __init__(self, n):
            self.n = n
            self.parents = [-1] * n
    
        #要素xの根を返す, その過程で経路圧縮も行う
        def find(self, x):
            if self.parents[x] < 0:
                return x
            else:
                self.parents[x] = self.find(self.parents[x])
                return self.parents[x]
    
        def union(self, x, y):
            x = self.find(x)
            y = self.find(y)
            if x == y:
                return
            #それぞれのsizeで比べる
            if self.parents[x] > self.parents[y]:
                x, y = y, x
            self.parents[x] += self.parents[y]
            self.parents[y] = x #根をくっつける(片方を親にする)
    
        #xが属するグループのsize
        def size(self, x):
            return -self.parents[self.find(x)]
    
        #xとyが同じグループかどうか
        def same(self, x, y):
            return self.find(x) == self.find(y)
    
        #xが属するグループの要素全てを返す
        def members(self, x):
            root = self.find(x)
            return [i for i in range(self.n) if self.find(i) == root]
    
        #全ての根の要素を返す
        def roots(self):
            return [i for i, x in enumerate(self.parents) if x < 0]
    
        #各グループの要素を辞書で返す
        def all_group_members(self):
            return {r: self.members(r) for r in self.roots()}
    
        #print(uf)
        def __str__(self):
            return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
    n,m = map(int, input().split())
    edge = [list(map(int, input().split())) for _ in range(m)]
    res = 0
    for i in range(m):
        uf = UnionFind(n)
        for j in range(m):
            if i==j:
                continue
            a,b = edge[j]
            uf.union(a-1,b-1)
        if uf.size(0)!=n:
            res += 1
    print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ll long long
#define ld long double
#define zeros(x) x^(x-1)&x
#define pii pair<ll,ll>
#define cd complex<double>
#define dbg(x) cerr<<#x<<": "<<x<<endl;
#define Nmax 200005
#define OFF 100001
using namespace std;

long long n, v[Nmax], v2[Nmax], ans;

int main()
{
    cin >> n;
    for (int i=1;i<=n;i++){
        cin >> v[i];
    }
    for (int i=1;i<=n;i++){
        if (v[i] % 2 && v[i+1]){
            ans++;
            v[i]--;
            v[i+1]--;
        }
        ans += v[i]/2;
        v[i] %= 2;
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;
// const ll MOD=998244353;

ll dp[101010][2];
ll INF=LLONG_MAX/2;

int main(){
  int N; cin>>N;
  int A[N]; rep(i,N) cin>>A[i];
  rep(i,101010) rep(j,2) dp[i][j]=-INF;
  dp[0][0]=0;
  rep(i,N-1) rep(j,2) if(dp[i][j]!=-INF){
    if(j==0){
      dp[i+1][0]=max(dp[i+1][0],dp[i][0]+A[i]);
      dp[i+1][1]=max(dp[i+1][1],dp[i][0]-A[i]);
    }else{
      dp[i+1][0]=max(dp[i+1][0],dp[i][1]-A[i]);
      dp[i+1][1]=max(dp[i+1][1],dp[i][1]+A[i]);
    }
  }
  cout<<max(dp[N-1][0]+A[N-1],dp[N-1][1]-A[N-1])<<endl;
  return 0;
}


Measured memory_bytes: 2176
n, m = map(int, input().split())

prices = []
numdict = {}

for _ in range(n):
  price, num = map(int, input().split())
  prices.append(price)
  if price in numdict:
    numdict[price] += num
  else:
    numdict[price] = num

prices_l = list(set(prices))
prices_l.sort()

result = 0
looped = 0

for mprice in prices_l:
  if numdict[mprice] <= (m - looped):
    result += mprice * numdict[mprice]
    looped += numdict[mprice]
  elif (m - looped) == 0:
    pass
  else:
    result += (m - looped) * mprice
    looped = m
  
print(result)

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

using namespace std;

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

	for (int i = 0; i < s.size(); ++i) {
		int idx = s[i] - 'A';
		idx = (idx + N) % 26;
		s[i] = idx + 'A';
	}
	cout << s << endl;

	return 0;
}


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

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
    ll x,y,a,b,c;cin>>x>>y>>a>>b>>c;
    vector<ll>va(a);
    vector<ll>vb(b);
    vector<ll>vc(c);
    for(int i=0;i<a;i++){
        cin>>va[i];
    }
    for(int i=0;i<b;i++){
        cin>>vb[i];
    }
    for(int i=0;i<c;i++){
        cin>>vc[i];
    }
    sort(va.rbegin(),va.rend());
    sort(vb.rbegin(),vb.rend());
    sort(vc.rbegin(),vc.rend());

    int q=x-1;int w=y-1;
    for(int i=0;i<c;i++){
        if(vc[i]>va[q]&&q>=0||vc[i]>vb[w]&&w>=0){
            if(q>=0&&w>=0){
                if(va[q]>vb[w]){
                    vb[w]=vc[i];
                    w--;
                }else{
                    va[q]=vc[i];
                    q--;
                }
            }else if(q>=0){
                va[q]=vc[i];
                q--;
            }else{
                vb[w]=vc[i];
                w--;
            }
        }else{
            break;
        }
    }
    ll sum=0;
    for(int i=0;i<x;i++)sum+=va[i];
    for(int i=0;i<y;i++)sum+=vb[i];
    cout<<sum<<"\n";
}



Measured memory_bytes: 2560
def resolve():
    A, B = list(map(int, input().split()))
    if B == 1:
        ans = 0
        print(ans)
        return
    cnt = A
    ans = 1
    while cnt < B:
        cnt += A-1
        ans += 1

    print(ans)

if '__main__' == __name__:
    resolve()

Measured memory_bytes: 9124
import itertools
n = int(input())
p = list(input().split())
q = list(input().split())
p = ''.join(p)
q = ''.join(q)
n_list = [str(i) for i in range(1, n + 1)]
n_comp = list(itertools.permutations(n_list, n))
n_join = []

for i in n_comp:
    n_join.append(''.join(i))
n_join.sort()

a = 0
b = 0
for i in range(len(n_join)):
    if n_join[i] == p:
        a = i + 1
    if n_join[i] == q:
        b = i + 1
print(abs(a - b))


Measured memory_bytes: 10868
#include <stdio.h>

int main(void)
{
  int N;
  scanf("%d", &N);
  long ans = 0;
  for(int i = 0; i < N; i++){
    long a;
    scanf("%ld", &a);
    while(a%2 == 0){
      ans++;
      a /= 2;
    }
  }
  printf("%ld", ans);
}

Measured memory_bytes: 128
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn main() {
    let v = read_vec::<u64>();
    let n = v[0] as u32;
    let mut x = v[1];

    let mut len = 2u64.pow(n);
    for i in 0..n {
        len += 2u64.pow(n - i - 1) * 3u64;
    }
    let mut pat = 2u64.pow(n + 1) - 1;

    let mut count: u64 = 0;
    loop {
        //println!("{} {}", len, pat);

        if x == (len + 1) / 2 {
            count += (pat + 1) / 2;
            break;
        } else if x == (len - 1) / 2 {
            count += (pat - 1) / 2;
            break;
        } else if x > (len + 1) / 2 {
            count += (pat + 1) / 2;
            x -= (len + 1) / 2;
        } else {
            x -= 1; // ban
        }

        pat = (pat - 1) / 2;
        len = (len - 3) / 2;

        if x == 0 { break; }
    }
    println!("{}", count);
}


Measured memory_bytes: 4352
#include <algorithm>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod 1000000007
#define int long long
#define double long double
#define INF INT_MAX
#define P pair<int,int>
#define prique priority_queue
using namespace std;
int a, b, c, d, e, f, g;
signed main() {
	cin >> a >> b >> c >> d >> e >> f >> g;
	if (a && d && e)cout << b + max(3 + (a - 1) / 2 * 2 + (d - 1) / 2 * 2 + (e - 1) / 2 * 2, a / 2 * 2 + d / 2 * 2 + e / 2 * 2) << endl;
	else cout << b + a / 2 * 2 + d / 2 * 2 + e / 2 * 2 << endl;
}

Measured memory_bytes: 256
K,S = map(int, input().split())

X_m = max(0, S - 2*K)
X_M = min(K, S)

ans = 0

for i in range(X_m, X_M+1):
    Y_m = max(0, S - i - K)
    Y_M = min(K, S - i)
    ans += Y_M - Y_m + 1

print(ans)

Measured memory_bytes: 9072
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.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>;

int main() {
  string s;
  cin >> s;
  cout << s.substr(0,3) << endl;
}


Measured memory_bytes: 3624
# Wrote in Mar 11, 2020 12:59 by reetok
require 'time'
require 'prime'
require 'bigdecimal'
def inp(type=:to_i,spst=" ")
  return eval("gets.chomp.split(#{spst}).map(&:#{type})")
end
def inpf() return self.inp(:to_f," ") end
def inps() return self.inp(:to_s," ") end
def r_up(a, b) (a/b).ceil end
def r_down(a, b) (a/b).floor end
def sum(a) a.inject(:+) end
def big(a,b) return (a>b)? a:b end
def small(a,b) return (a<b)? a:b end
def minp(n,datatype=".to_i")
  t = []
  n.times do
    t.push(eval("gets.chomp#{datatype}"))
  end
  return t
end
def yes() puts "Yes" end
def no() puts "No" end
def ynju(bool,yes="Yes",no="No") puts (bool ? yes : no) end
class Integer
  def divisor_list
    devisors = [1]
    2.upto(self/2) do |i|
      devisors << i if self%i == 0
    end
    devisors << self
    return devisors.uniq.sort
  end
end
class Array
  def upper(a) #aより上
    self.sort.select{|n|n>=a}
  end
  def downer(a) #aより下
    self.sort.select{|n|n<=a}
  end
end
#---------------

n = gets.to_i
t = minp(n,".split.map(&:to_i)")
a = [
[
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
],
[
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
],
[
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
],
[
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
]
      ]
t.each do |n|
  a[n[0]-1][n[1]-1][n[2]-1]=a[n[0]-1][n[1]-1][n[2]-1]+n[3]
end
i = 0
a.each do |n1|
  n1.each do |n2|
    n2.each do |n3|
      print " #{n3}"
    end
    print "\n"
  end
  print "####################\n" if i!=3
  i+=1
end



Measured memory_bytes: 7420
mod=998244353 

N=int(input())
alist=[]
all_num=1
for i in range(N):
  alist.append(int(input()))
  all_num *= 3
  all_num %= mod
  
asum=sum(alist)
#print(alist)
#print(all_num)

dp=[]
dp2=[]
for _ in range(N+1):
  dp.append([0]*(asum+1))
  dp2.append([0]*(asum+1))
  
dp[0][0]=1
dp2[0][0]=1
#print(dp)
for i in range(N):
  a=alist[i]
  for j in range(asum):
    dp[i+1][j] += 2*dp[i][j]
    dp[i+1][j] %= mod
    dp2[i+1][j] += dp2[i][j]
    dp2[i+1][j] %= mod
    if dp[i][j] > 0:
      dp[i+1][j+a] += dp[i][j]
      dp[i+1][j+a] %= mod
      dp2[i+1][j+a] += dp2[i][j]
      dp2[i+1][j+a] %= mod
    
#print(dp)
#print(dp2)

invalid_num = sum(dp[N][(asum+1)//2:])%mod 
#print(invalid_num)

if asum%2 == 0:
  print((all_num-3*invalid_num+3*dp2[N][asum//2])%mod)
else:
  print((all_num-3*invalid_num)%mod)


Measured memory_bytes: 458264
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
vector<int> v,w;
int main(){
	long long i,j,n,m;
	cin >> n >> m;
	for(i=0;i<n;i++){
		int x; cin >> x;
		v.push_back(x);
		w.push_back(x);
	}
	sort(v.begin(),v.end());
	sort(w.rbegin(),w.rend());
	int l = 0,r = 200010;
	while(r - l>1){
		int mid = (l + r)/2;
		int ll = 0;
		long long k = 0;
		for(i=0;i<n;i++){
			for(j=ll;j<n;j++){
				if(v[i] + w[j]<mid){
					ll = j;
					k += j;
					break;
				}
				if(j==n - 1){
					k += n;
					ll = n - 1;
				}
			}
		}
		if(k>=m) l = mid;
		else r = mid;
	}
	/*for(i=0;i<n;i++){
		cout << v[i] << " ";
	}
	cout << endl;
	for(i=0;i<n;i++){
		cout << w[i] << " ";
	}
	cout << endl;*/
	//cout << l << " " << r << endl;
	long long sum = 0,num = 0,ans = 0;
	int ll = 0;
	bool flag = true;
	for(i=0;i<n;i++){
		for(j=ll;j<n;j++){
			if(v[i] + w[j]>l){
				if(flag) sum += w[j];
			}else{
				ll = j;
				num += j;
				ans += v[i]*j + sum;
		//		cout << i << "a " << j << " " << ans << endl;
				break;
			}
			if(j==n - 1){
				ll = n - 1;
				num += n;
				ans += v[i]*n + sum;
				flag = false;
		//		cout << i << "b " << n << " " << ans << endl;
			}
		}
	}
	//cout << ans << " " << num << endl;
	//cout << " c " << endl;
	map<long long,long long> mp;
	map<long long,vector<pair<int,int>>> mpv;
	vector<int> vec[100];
	/*for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			mp[v[i] + w[j]]++;
			mpv[v[i] + w[j]].push_back({i,j});
			if(v[i] + w[j]>l) vec[i].push_back(j);
		}
	}*/
	/*for(auto x:mp){
		cout << x.first << " " << x.second << endl;
		if(x.first>l){
			ans1 += x.first*x.second;
			y += x.second;
		}
	}
	for(auto x:mpv){
		if(x.first>l){
			for(i=0;i<x.second.size();i++){
				cout << x.second[i].first << " " << x.second[i].second << endl;
			}
		}
	}*/
	/*for(i=0;i<n;i++){
		sort(vec[i].begin(),vec[i].end());
		cout << i << " "<< vec[i].back() << endl;
	}
	long long s = 0;
	for(i=0;i<n;i++){
		for(j=0;j<=vec[i].back();j++){
			s += v[i] + w[j];
		}
		cout <<i << " " <<  s << endl;
	}*/
	ans += (m - num)*l;
	cout << ans << endl;
}

Measured memory_bytes: 1276
c11,c12,c13 = map(int, input().split())
c21,c22,c23 = map(int, input().split())
c31,c32,c33 = map(int, input().split())
if c21-c11==c22-c12==c23-c13 and c31-c21==c32-c22==c33-c23:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
while(1){
  int n,m;
  int p[10000];
  int sum=0;
  cin>>n>>m;
  if(n==0 && m==0) break;
  for(int i=0;i<n;i++){
    cin>>p[i];
    }
  for(int i=0;i<n;i++){
    for(int j=0;j<n-1;j++){
      if(p[j]<p[j+1]) swap(p[j],p[j+1]);
      }
    }
  for(int i=0;i<n;i++){
    if(i%m==m-1) p[i]=0;
    }
  for(int i=0;i<n;i++){
    sum+=p[i];
    }
  cout<<sum<<endl;
}

  return 0;
}


Measured memory_bytes: 3060
result = 'Yes'

# 回数の取得
N = int(input())
data = [[0, 0, 0]]
# 目的地の取得
for i in range(N):
	data.append(list(map(int, input().split())))

# 目的地間の最短距離での必要移動回数が(実移動回数 + 2x)であれば、移動可能
for move_index in range(N):
  start = data[move_index]
  end   = data[move_index + 1]
  
  # 移動回数
  move_count = end[0] - start[0]
  # 最短移動回数
  min_move = abs(end[1] - start[1]) + abs(end[2] - start[2])
  # 移動可能かを判断
  if min_move > move_count:     # 最短経路で進んでも到達できない場合
    result = 'No'
    break
  elif min_move == move_count:	# 最短経路で進めば到達できる場合
    pass
  else:							# 寄り道をする場合
    exceed_count = move_count - min_move
    if exceed_count % 2 == 0:
      pass
    else:
      result = 'No'
      break
      
# 結果の表示
print(result)
    

Measured memory_bytes: 26940
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n, k;
	cin >> n >> k;
	
	ll ans = 0LL;
	
	for(ll i = k; i <= n + 1; ++i) {
		ll a = i * n - i * (i - 1) / 2;
		ll b = i * (i - 1) / 2;
		a %= MOD_LL;
		b %= MOD_LL;
		ans += (a - b + 1LL) % MOD_LL;
		ans %= MOD_LL;
	}
	
	if( ans < 0 ) ans += MOD_LL;
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3580
import java.util.Scanner;

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

        long n = sc.nextLong();

        if(n % 2 == 0 && n % n == 0) {
            System.out.println(n);
        } else if (n % 2 == 0) {
            System.out.println(n*3);
        } else {
            System.out.println(n*2);
        }
        sc.close();
    }
}


Measured memory_bytes: 23764
#include <stdio.h>
int main(void)
{
    int f[11];
    int a,b,c;
    while (scanf("%d%d%d",&a,&b,&c) != EOF) {
        int i, c=0;
        int s = a+b;
        for (i=1; i<=10; ++i) f[i]=0;
        f[a]=f[b]=f[c]=1;
        for (i=1; i<=10; ++i)
            if (!f[i] && a+b+i<=20) c++;
        puts(2*c >= 7 ? "YES" : "NO");
    }
    return 0;
}

Measured memory_bytes: 580
def main():
  n = int(input())
  a = [0]*n
  for i in range(n):
    a[i] += int(input())

  s = 1
  for i in range(n):
    if a[s-1] == 2:
      print(i+1)
      exit()
    else:
      s = a[s-1]
  print(-1)
  
if __name__=='__main__':
  main()

Measured memory_bytes: 6900
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String strArr[] = br.readLine().split(" ");
            int r = Integer.parseInt(strArr[0]);
            int g = Integer.parseInt(strArr[1]);
            int b = Integer.parseInt(strArr[2]);
            int num = r * 100 + g * 10 + b;
            if (num % 4 == 0) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
       } catch (IOException e) {
            e.printStackTrace();
       }
    }
}


Measured memory_bytes: 20052
#include<stdio.h>
#include<stdlib.h>
#define MAX 10

int main() {
	int i,j,c,W,H,x,y,r;
	char data[5][MAX];
	
	i = 0; j = 0;
	while((c = getchar()) != EOF) {
		if(c == ' ') {
			i++;
			j = 0;
		}else{
			data[i][j] = c;
			j++;
		}
	}
	W = atoi(data[0]);
	H = atoi(data[1]);
	x = atoi(data[2]);
	y = atoi(data[3]);
	r = atoi(data[4]);
	
	if(y + r <= H && y - r >= 0 && x + r <= W && x - r >= 0) {
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	
	return 0;
}

Measured memory_bytes: 524
n=int(input())
s=[list(map(int, input().split()))  for i in range(n)]
x=[]
if n==1:
    print(1)
    exit(0)

for i in range(n):
    for j in range(n):
        if i==j:
            continue
        t=(s[i][0]-s[j][0],s[i][1]-s[j][1])
        x.append(t)
        
ans = [x.count(i) for i in set(x)]
print(n-max(ans))

Measured memory_bytes: 3444
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DEBUG 0
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) if(DEBUG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DEBUG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
using ll = long long; using ull = unsigned long long; using pii = pair<int, int>;
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
static const int MOD = 1e9 + 7;

signed main() {
	int a[20010] = {};
	for (int n, m; cin >> n >> m && (n || m);) {
		rep(i, 0, n + m)cin >> a[i];
		a[n + m] = 0;
		sort(a, a + n + m + 1);
		int M = 0;
		rep(i, 1, n + m + 1) {
			M = max(M, a[i] - a[i - 1]);
		}
		cout << M << endl;
	}
	return 0;
}

Measured memory_bytes: 3200
use std::str::FromStr;
use std::collections::{HashMap,HashSet,VecDeque,BinaryHeap};
use std::cmp::{max,min,Ordering};
use std::io::Read;

fn main() {

    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut buf_it = buf.split_whitespace();

    let N = buf_it.next().unwrap().parse::<usize>().unwrap();
    let A = (0..N).map(|_| buf_it.next().unwrap().parse::<usize>().unwrap()).collect::<Vec<_>>();

    let Q = buf_it.next().unwrap().parse::<usize>().unwrap();
    let M = (0..Q).map(|_| buf_it.next().unwrap().parse::<usize>().unwrap()).collect::<Vec<_>>();


    let mut ans = HashSet::new();
    ans.insert(0);
    for &a in &A{
        let tmp = ans.iter().map(|&b| a+b).collect::<HashSet<_>>();
        ans = ans.union(&tmp).map(|&a| a).collect();
    }

    for m in &M{
        println!("{}",if ans.contains(m) {"yes"} else {"no"});
    }

}


Measured memory_bytes: 5032
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
int main() {
    ll N, K, ans = 1e12;
    cin >> N >> K;
    vector<ll> A(N), F(N);
    for (auto& i : A) cin >> i;
    for (auto& i : F) cin >> i;
    sort(A.begin(), A.end());
    sort(F.begin(), F.end(), greater<ll>());
    ll l = 0, r = 1e12;
    while (l < r) {
        ll x = (l + r) / 2;
        ll tmp = 0;
        for (ll i = 0; i < N; i++) tmp += max(A[i] - x / F[i], 0LL);
        if (tmp <= K) {
            ans = x;
            r = x;
        }
        else l = x + 1;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a*c <= b) cout << c << endl;
    else cout << b/a;
}

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

using namespace std;

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

  int n;
  cin >> n;
  map<string, bool> w;
  string ans = "Yes";
  string s, ps;
  cin >> s;
  ps = s;
  w[s] = true;
  for (int i = 1; i < n; ++i) {
    cin >> s;
    if (ps[ps.size() - 1] != s[0]) {
      ans = "No";
      break;
    }
    if (w.count(s)) {
      ans = "No";
      break;
    } else {
      w[s] = true;
    }
    ps = s;
  }

  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 3636