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

int main(){
    //int min = INT_MIN;
    int n;
    cin >> n;
    vector< vector<int> > a(n, vector<int> (3) );

    for(int i = 0; i < n; i++){
        for(int j = 0; j < 3; j++){
            cin >> a.at(i).at(j);
        }
    }

    vector< vector<int> > dp(n + 1, vector<int> (3) );
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 3; j++){
            dp.at(i).at(j) = 0;
        }
    }

    dp.at(0).at(0) = a.at(0).at(0);
    dp.at(0).at(1) = a.at(0).at(1);
    dp.at(0).at(2) = a.at(0).at(2);


    for(int i = 1; i < n; i++){
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(j == k) continue;

                dp.at(i).at(j) = max(dp.at(i).at(j), dp.at(i - 1).at(k) + a.at(i).at(j));
            }
            //cout << dp.at(i).at(j) << endl;
        }
    }

    int result = 0;
    for(int i = 0; i < 3; i++){
        if(result < dp.at(n - 1).at(i)){
            result = dp.at(n - 1).at(i);
        }
    }

    cout << result << endl;


}

Measured memory_bytes: 11136
N, *A = map(int, open(0).read().split())

s = list(abs(x) for x in A)
cnt = sum(x < 0 for x in A)
if (cnt % 2 == 0) or (0 in A):
    print(sum(s))
else:
    print(sum(s) - 2 * min(s))



Measured memory_bytes: 72460
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int dis=0;
int vis[100050];
struct point
{
    int x,y;
};
point a[100050];
point b[100050];
bool cmp(point a,point b)
{
    return a.x<b.x;
}
void fid(int x)
{
    vis[x]=1;
    dis++;
    if(vis[a[x].y]==0)
        fid(a[x].y);
}
int main()
{
    memset(vis,0,sizeof(vis));
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i].x);
    }
    for(int i=0;i<n;i++)
    {
        scanf("%d",&b[i].x);
        b[i].y=i;
    }
    sort(b,b+n,cmp);
    for(int i=0;i<n;i++)
        a[b[i].y].y=i;
    sort(a,a+n,cmp);
    fid(a[0].y);
    for(int i=0;i<n;i++)
        if(a[i].x>b[i].x)
        {
            puts("No");
            return 0;
        }
    for(int i=0;i<n-1;i++)
    {
        if(a[i+1].x<=b[i].x)
        {
            puts("Yes");
            return 0;
        }
    }
    if(dis==n)
        puts("No");
    else puts("Yes");
    return 0;
}


Measured memory_bytes: 2176
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.Random;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);
	
	
	public static void main(String[] args) {
		//int N=sc.nextInt();for(int i=0;i<N;i++) {}
		//int a[]=new int[N];
		//Ae2+Be2=Ce2
		//StringBuffer str = new StringBuffer(hoge1);
		//for(int i=0;i<N;i++) {}
		
		//int N=sc.nextInt();for(int i=0;i<N;i++) {}
		String S=sc.next();
		int v=0;
		char a ;
		out:for(int i=0;i<S.length();) {
			a=S.charAt(i);
			v++;
			while(a==S.charAt(i)) {
				i++;
				if(i==S.length())break out;
			}
			
			
		}
		p(v-1);
		
		
	}
	
		
	
	
		
	
	public static long modPow(long g,long N) {
		long T=1;
		for(int i=0;i<N;i++) {
			T*=g;
			T%=mod;
		}
		return T;
	}
	
	public static long lcm(long a, long b) {
        return a / gcd(a, b) * b;
	}
	
	public static long gcd(long a, long b) {
        return b == 0 ? a: gcd(b, a % b);
	}

	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	
}
	


Measured memory_bytes: 25188
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <utility>

using namespace std;

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    vector<int> a(n, 0);
    for (int i = 0; i < m; ++i) {
        int v1, v2;
        scanf("%d%d", &v1, &v2);
        --v1; --v2;
        a[v1]++;
        a[v2]++;
    }
    
    for (int i = 0; i < n; ++i)
        if (a[i]%2 != 0) {
           cout << "NO\n";
           return 0;
        }
    cout << "YES\n";
    
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstring>
#include <cmath> 
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;   
int main()  
{
    string s;
    cin>>s;
    for(int i=0;i<s.size()-8;i++)cout<<s[i]; 
    cout<<endl;

//    system("pause");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define REVETSE(c) reverse((c).begin(),(c).end())
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define ALL(a)  (a).begin(),(a).end()
// int gcd(int a,int b){return b?gcd(b,a%b):a;}
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}

using namespace std;

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();}
template<class T> T maxt(T x,T y) {
    if (x>y) return x;
    else return y;
}
template<class T> T mint(T x,T y) {
    if (x>y) return y;
    else return x;
}
//sort(v.rbegin(), v.rend(), [](auto& x, auto& y){return x[1] < y[1];});
//cout << fixed << setprecision(10) << ans << defaultfloat << endl;
typedef long long ll;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef vector<double> Vd;
typedef vector<string> Vs;

//小数出力
double print_double(double d){printf("%.8f", d);}

long long m = 1e9+7, mod = 1e9+7;
//逆元　a/b の modをとるとき -> a*modinv(b)%mod
long long modinv(long long a, long long m = 1e9+7) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

//約数列挙
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}











int main() {
  int N;
  ll W,w,v;
  cin >> N >> W;
  
  vector<Vl> dp(N+1, Vl(1000*N+1,-1));
  dp[0][0] = W;
  FOR(i,1,N+1) {
    cin >> w >> v;
    FOR(j,0,1000*N+1){
      dp[i][j] = dp[i-1][j];
      if (j-v>=0) dp[i][j] = maxt(dp[i][j],dp[i-1][j-v]-w);
    }
  }
  ll ans = 0;
  rep(i,1000*N) {
    if (dp[N][i+1]>=0) ans = i+1;}
  cout << ans;
}

Measured memory_bytes: 80256
#include <stdio.h>
#include <bits/stdc++.h>
     
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)

using namespace std;

const int N = 200000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const double eps = 1e-6;
const double pi = atan2(0, -1);
const int ABC = 26;

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    cout << fixed;
    //ll TL = 1.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    ll k;
    cin >> k;
    int n = 50;
    ll a[n];
    rep(i, 0, n)
        a[i] = i + k / n;
    k %= n;
    while (k--)
    {
        int p = 0;
        rep(i, 0, n)
            if (a[i] < a[p])
                p = i;
        rep(i, 0, n)
            if (i == p)
                a[i] += n;
            else
                a[i]--;
    }
    cout << n << "\n";
    rep(i, 0, n)
        cout << a[i] << " ";
    cout << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
int a,b,c,d=0;
scanf ("%d%d",&a,&b);
if ((b-b%10)/10 == 0){
c=a*10+b;
}
else if ((b-b%100)/100 == 0){
c=a*100+b;
}
else {
c=a*1000+b;
}
for (int i=0;i<c*100;i++){
if (c == i*i){
  d=1;
}
}
if (d==1){
printf ("Yes");
}
else{
printf ("No");
}
return 0;
}

Measured memory_bytes: 256
//#include<iostream>
//#include<algorithm>
//#include<string>
//#include <cmath>
//#include <vector>
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define REP(x,n) for(int x=0;x<n;x++)

//vector//
#define vei vector<int> 
#define velli vector<long long int> 
#define pb(x) push_back(x) // 末尾にxを加える
#define pb2 pop_back() // 末尾削除
#define all(x) (x).begin(),(x).end() //イテレーター
#define be(x) (x).begin()
//auto  auto begin = v.begin()とか

typedef pair<int,int> P;  //q(p.first,p.second)

int main (){
    int n; cin >> n;
    int m; cin >> m;
    vector<int> x(m);
    for(int i=0; i<m; i++){
        cin >> x[i];
    }

    sort(x.begin(),x.end());
    
    vector<int> sa(m-1);
    for(int i=0; i<m-1; i++){
        sa[i] = x[i+1] - x[i];
    }

    sort(sa.begin(),sa.end());
    // reverse(sa.begin(),sa.end());

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

    cout << ans;
}

Measured memory_bytes: 4028
using System;
class aoj1_10{
  public static void Main(){
    int sum = 0;
    double sum2 = 0;
    double ave, std2, std;
    String[] str;
    int n = int.Parse(Console.ReadLine());
    while(n!=0){
      sum = 0;
      sum2 = 0;
      str = Console.ReadLine().Split(' ');
      foreach(String s in str){
        sum += int.Parse(s);
      }
      ave = sum/(double)n;
      foreach(String s in str){
        sum2 += (double.Parse(s)-ave)*(double.Parse(s)-ave);
      }
      std2 = sum2/(double)n;
      std = Math.Sqrt(std2);
      Console.WriteLine("{0:F8}",std);
      n = int.Parse(Console.ReadLine());
    }
  }
}



Measured memory_bytes: 18040
/* 
 *Author : Sisir Ramanan
 *Date : 
 */
 
#include <bits/stdc++.h>

using namespace std;


int main(){

    string s;
    cin >> s;
    string t;
    cin >> t;

    int count = 0;
    for(int i=0; i<s.length(); ++i){
        if(s[i]!=t[i]) count++;
    }

    cout << count << endl;
	return 0;
}



Measured memory_bytes: 3772
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
int main(){
string str;
cin >> str;
int length=str.size();

int Achange=0;
for(int i=0;i<length;i=i+2){
    if(str[i]!='0')
    Achange++;
}
if(length!=1){
    for(int i=1;i<length;i=i+2){
    if(str[i]!='1')
    Achange++;
    }
}
int Bchange=length-Achange;
if(Achange<=length/2)
cout << Achange <<endl;
else
cout << Bchange <<endl;



 return 0;
}

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



int main()
{
	char buffer[20];
	int stac[100], stac_num = 0;
	while (1)
	{
		if (!(cin >> buffer))
			break;
		else if (buffer[0] >= '1' && buffer[0] <= '9')
		{
			stac[stac_num] = atoi(buffer);
			stac_num++;
		}
		else
		{
			switch (buffer[0])
			{
			case '+':
				stac[stac_num - 2] += stac[stac_num - 1];
				break;
			case '*':
				stac[stac_num - 2] *= stac[stac_num - 1];
				break;
			case '-':
				stac[stac_num - 2] -= stac[stac_num - 1];
				break;
			}
			stac_num--;
		}
	}

	cout << stac[0] << endl;
	return 0;
}


Measured memory_bytes: 3128
<?php
fscanf(STDIN, "%d %d", $l, $r);


$min = INF;

for ($i = $l; $i < $r; ++$i) {
    for ($j = $l+1; $j <= $r; ++$j) {
        $tmp = ($i * $j) % 2019;
        if ($min > $tmp) {
            $min = $tmp;
        }
        if ($min == 0) {
            echo $min, "\n";
            return;
        }
    }
}

echo $min, "\n";

Measured memory_bytes: 3700
#include<iostream>
#include<stdio.h>

/* クイックソートを行う */
void QSort(long long *x, long long *y, int left, int right)
{
	int i, j;
	int pivot;
	i = left;                      /* ソートする配列の一番小さい要素の添字 */
	j = right;                     /* ソートする配列の一番大きい要素の添字 */

	pivot = x[(left + right) / 2]; /* 基準値を配列の中央付近にとる */

	while (1) {                    /* 無限ループ */

		while (x[i] < pivot)       /* pivot より大きい値が */
			i++;                   /* 出るまで i を増加させる */

		while (pivot < x[j])       /* pivot より小さい値が */
			j--;                   /*  出るまで j を減少させる */
		if (i >= j)                /* i >= j なら */
			break;                 /* 無限ループから抜ける */

		int temp;

		temp = x[i];
		x[i] = x[j];
		x[j] = temp;            /* x[i] と x[j]を交換 */
		temp = y[i];
		y[i] = y[j];
		y[j] = temp;
		i++;                       /* 次のデータ */
		j--;
	}

	if (left < i - 1)              /* 基準値の左に 2 以上要素があれば */
		QSort(x, y, left, i - 1);     /* 左の配列を Q ソートする */
	if (j + 1 < right)            /* 基準値の右に 2 以上要素があれば */
		QSort(x, y, j + 1, right);    /* 右の配列を Q ソートする */
}

int main() {
	int N = 0;
	int M = 0;
	long long sum = 0;


	std::cin >> N;
	std::cin >> M;

	long long *A = new long long[N];
	long long *B = new long long[N];

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

	QSort(A, B, 0, N - 1);

	for (int i = 0; i < N; i++) {
		if (M == 0) {
			break;
		}
		else if (M != 0 && M < B[i]) {
			sum += A[i] * M;
			M -= M;
		}
		else {
			sum += A[i] * B[i];
			M -= B[i];
		}
	}
	
	std::cout << sum << std::endl;

}

Measured memory_bytes: 1792
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a[ohara], b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> n >> k;
  rep(i, n) cin >> a[i];
  rrep(i, k, n) {
    if (a[i] > a[i - k])
      Cout("Yes");
    else
      Cout("No");
  }
  return 0;
}

Measured memory_bytes: 5208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define pi 3.141592653589793
#define mod 1000000007
#define pb push_back
#define all(v) v.begin(),v.end()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, greater_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;

int main() {
	fast_io;
	ll n, k;
	cin >> n >> k;
	if (n >= k) {
		n = n % k;
	}
	if (n < k - n)
		cout << n << '\n';
	else
		cout << k - n << '\n';
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cstring>
#include<string>
using namespace std;
int n,a,c[300010],k,q[300010];
bool judge(int samp){
	int l=1,r=n,mid,ans;
	while(l<=r){
		mid=(l+r)/2;
		if(c[mid]<samp&&(mid==n||c[mid+1]>=samp)){ans=mid;break;}
		else if(c[mid]<samp) l=mid+1;
		else r=mid-1;
	}
	if((n-ans)*samp+q[ans]>=k*samp) return true;
	return false;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a),c[a]++;
	sort(c+1,c+n+1);
	for(int i=1;i<=n;i++) q[i]=q[i-1]+c[i];
	int x=n;
	for(k=1;k<=n;k++){
		while(x>=0&&!judge(x)) x--;
		printf("%d\n",x);
	}
}

Measured memory_bytes: 3200
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};
 
 
int main() {
  string temp, a;
  cin >> temp;
  cin >> a;
  cin >> temp;
  cout << "A" << a[0] << "C" << endl;
  return 0;
}

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

int main(void){
    int n,d,k;
    int cho=0;
    int a[105];
    scanf("%d %d %d",&n,&d,&k);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }

    for(int i=0;i<n;i++){
        for(int j=0;;j++){
            if(a[i]*j+1<=d){cho++;}
            else{break;}
        }
    }
cho=cho+k;
printf("%d",cho);


}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define show(x) cout <<#x<<" = "<<(x)<<endl
#define spair(p) cout <<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl

using namespace std;

typedef pair<int,int>P;

int dp[(1 << 15)][15];
int d[15][15];

int main()
{
    int n,m;
    cin >> n >> m;
    rep(i,n){
        rep(j,n){
            d[i][j] = INF;
        }
    }
    rep(i,m){
        int a,b,c;
        cin >> a >> b >> c;
        d[a][b] = c;
    }
    int ans = INF;
    rep(id,n){
        rep(i,(1 << n)){
            rep(j,n){
                dp[i][j] = INF;
            }
        }
        dp[0][id] = 0;
        rep(i,1<<n){
            rep(j,n){
                rep(k,n){
                    if(!(i & (1 << k)) && j != k){
                        dp[i|(1<<k)][j] = min(dp[i|(1<<k)][j],dp[i][k] + d[k][j]);
                    }
                }
            }
        }
        rep(i,n){
            ans = min(ans,dp[(1<<n)-1][id]);
        }
    }
    if(ans == INF){
        cout << "-1\n";
    }else{
        cout << ans << endl;
    }
}

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

int main() {
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    
    int dx = tx - sx, dy = ty - sy;
    
    for(int _u = 0; _u < dy; _u++) cout << 'U';
    for(int _r = 0; _r < dx; _r++) cout << 'R';
    for(int _d = 0; _d < dy; _d++) cout << 'D';
    
    for(int _l = 0; _l < dx + 1; _l++) cout << 'L';
    for(int _u = 0; _u < dy + 1; _u++) cout << 'U';
    for(int _r = 0; _r < dx + 1; _r++) cout << 'R';
    
    cout << "DR";
    for(int _d = 0; _d < dy + 1; _d++) cout << 'D';
    for(int _l = 0; _l < dx + 1; _l++) cout << 'L';
    cout << 'U';
    
	return 0;
}

Measured memory_bytes: 256
import fractions
a,b,c,d = map(int, input().split())
cc = b//c - (a-1)//c
dd = b//d - (a-1)//d
gcd = int(c*d / fractions.gcd(c, d))
cd = b//gcd - (a-1)//gcd

print((b-a+1) + cd - cc -dd)


Measured memory_bytes: 64236
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main(){
    int N,L;cin>>N>>L;
    int a;
    int sum=0;
    int absmini=300;
    int minimu;
    rep(i,N){
        a=L+i;
        sum+=a;
        if(absmini>abs(a)){
            absmini=abs(a);
            minimu=a;
        }
    }
    sum-=minimu;
    cout<<sum<<endl;
}



Measured memory_bytes: 3640
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define sz(x) (int)(x).size()
#define mem(a,v) memset((a), (v), sizeof (a))
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%lld", &(n))
#define nai(a, n) for (int _i = 0; _i < (n); _i++) ni(a[_i])
#define nal(a, n) for (int _i = 0; _i < (n); _i++) nl(a[_i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%lld\n", (n))
#define pii pair<int, int>
#define pil pair<int, long long>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vil vector<pil>
#define vll vector<pll>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef cc_hash_table<int,int,hash<int>> ht;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e6 + 5;
const double eps = 1e-9;
ll a[MAXN], s[MAXN];

int main() {
	int n, v, p; ll m; scanf("%d %lld %d %d", &n, &m, &v, &p);
	for (int i = 0; i < n; i++)
		scanf("%lld", a+i);
	sort(a, a+n);
	s[0] = a[0];
	for (int i = 1; i < n; i++)
		s[i] = s[i-1] + a[i];
	int ans = p;
	v -= p;
	for (int i = 0; i+p < n; i++) {
		int idx = upper_bound(a, a + n, a[i] + m) - a - 1;
		if (n - idx > p)
			continue;
		if (v <= i) {
			ans++;
			continue;
		}
		idx = min(idx, n-p);
		if (i+1 > idx)
			continue;
		ll sm = (ll)(idx - i) * (m + a[i]) - (s[idx] - s[i]);
		if (m * (ll)(v - i) <= sm && idx >= v)
			ans++;
	}
	printf("%d\n", ans);
	return 0;
}


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

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

// a^{-1} mod を計算する
long modinv(long a, long mod) {
    return modpow(a, mod - 2, mod);
}

int main()
{
    string str;
    cin >> str;
    if(str.size() % 2 == 0){
        bool flag = true;
        REP(i, str.size()/2){
            if(str[2*i] != 'h' || str[2*i+1] != 'i')
                flag = false;
        }
        if(flag)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }else
        cout << "No" << endl;


    return 0;
}



Measured memory_bytes: 256
function Main(input) {
	var arr = input.split('');
  	
  	const ramen = 700;
  	var count = 0;
  	if(arr[0] === "o"){ count++; }
  	if(arr[1] === "o"){ count++; }
	if(arr[2] === "o"){ count++; }
  		
  	var sum = 700 + count*100;
  	console.log(sum);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define sz(arr) (int)arr.size()
#define all(arr) arr.begin(), arr.end()

using namespace std;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

int main() {
  Cin(string, s);

  for (int i = 0; i < sz(s) - 1; ++i) {
    if (s.substr(i, 2) == "AC") {
      puts("Yes");
      return 0;
    }
  }
  puts("No");

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
   int a, b, c;
   int min1, min2;
   scanf("%d", &a);
   scanf("%d", &b);
   scanf("%d", &c);
   if(a<=b){
      if(b<=c){
         min1 = a;
         min2 = b;
      }else{min1 = a;
            min2 = c;
      }
   }else{if(a<=c){
         min1 = b;
         min2 = a;
      }else{min1 = b;
            min2 = c;
      }
   }
   printf("%d\n", min1+min2);
   return 0;
}


Measured memory_bytes: 128
#include<cstdio>
using namespace std;
int main()
{
	int a,b,c,d,p,x,y;
	scanf("%d %d %d %d %d",&a,&b,&c,&d,&p);
	x=a*p;
	if(p>c){
		y=p-c;
		y=y*d+b;
	}
	else{
		y=b;
	}
	if(x<y){
		printf("%d\n",x);
	}
	else{
		printf("%d\n",y);
	}
	return 0;
}



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

struct edge{
    int a, b;
};

bool visited[52]={0};

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

    vector<int> graph[53];
    vector<edge> e;
    for(int i=0;i<m;++i){
        int a, b;
        cin >> a >> b;
        graph[a].push_back(b);
        graph[b].push_back(a);
        e.push_back((edge){a,b});
    }

    int ans = 0;
    for(int i=0;i<m;++i){
        for(int j=1;j<=n;++j)visited[j] = false;
        queue<int> que;
        que.push(1);
        visited[1] = true;
        while(!que.empty()){
            int now = que.front(); que.pop();
            for(int j=0;j<graph[now].size();++j){
                int next = graph[now][j];
                if((now != e[i].a || next != e[i].b) && (now != e[i].b || next != e[i].a)){
                    if(!visited[next]){
                        visited[next] = true;
                        que.push(next);
                    }
                }
            }
        }
        for(int j=1;j<=n;++j){
            if(!visited[j]){
                ans++;
                break;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>


using namespace std;
int cnt=0;
void insertionsort(int array[], int n, int g){
    int i,j,v;
    for (i=g;i<n;i++){
        j=i-g;
        v=array[i];
        while(j>=0 and v<array[j]){
            array[j+g]=array[j];
            j-=g;
            cnt++;
        }

        array[j+g]=v;

    }
}

void shellsort(int array[],int n){
    int m=1,i;
    int G[100],temp[100];temp[0]=1;
    for(i=1;i<100;i++){
        temp[i]=3*temp[i-1]+1;
        if(temp[i]>n) break;
        m=i+1;
    }
    for(i=0;i<m;i++)G[i]=temp[m-1-i];
    cout<<m<<endl;
    for (i=0;i<m;i++){
        cout << G[i] << ((i==m-1)?'\n':' ');
    }
    for (i=0;i<m;i++) insertionsort(array, n, G[i]);
}

int main()
{
    int n,i,k;
    cin >> n;
    int array[n];
    for (i=0;i<n;i++){
        cin>>array[i];
    }
    shellsort(array,n);
    cout<<cnt<<endl;
    for (k=0;k<n;k++){
        cout << array[k] << '\n';
    }

}


Measured memory_bytes: 6976
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    int a, b;
    cin >> a >> b;
    int m = max(a,b);
    if (m > 9) cout << -1 << endl;
    else cout << a * b << endl;

    return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, BinaryHeap, VecDeque, BTreeSet, BTreeMap};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::io::stdin;

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

#[allow(unused_macros)]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
                   ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
                   ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    const M: u64 = 1000000007;
    let n = get!(usize);

    let mut list = (2..n + 1).collect::<Vec<_>>();
    let mut div = HashMap::new();

    for i in 2.. {
        if list.is_empty() {
            break;
        }
        let mut next = Vec::new();

        for &d in &list {
            let mut d = d;
            let mut count = 0;
            while d % i == 0 {
                d /= i;
                count += 1;
            }
            *div.entry(i).or_insert(0) += count;
            if d > 1 {
                next.push(d);
            }
        }

        list = next;
    }

    println!("{}", div.values().map(|&x| x + 1).fold(1, |x, y| x * y % M));
}


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

using namespace std;

#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORD(i, m, n) for (int i = m; i >= n; i--)
#define REP(i, n) for (int i = 0; i < n; i++)
#define REP1(i, n) for (int i = 0; i <= n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

using ll = long long;
using ull = unsigned long long;
using ld = long double;



int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int x;
	cin>>x;
	if(x>=30)cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

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

map<string, bool> mp;

int n;

int main(void) {
	scanf("%d", &n);
	string s2 = "";
	for (int i = 1; i <= n; ++ i) {
		string s; cin >> s;		
		if (s2 != "") {
			if (s2[s2.length() - 1] != s[0] || mp[s]) return 0 * puts("No");
		}
		s2 = s;	mp[s] ++;	
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 384
i,a[1<<17],b[1<<17];c;
main(s){
	for(;~(c=getchar_unlocked());)c-10?a[i]=a[i]*10+c-48:++i;
	for(b[i=s]=1;++b[s=a[s]]&1&&s-2;++i);
	printf("%d",s-2?-1:i);
}

Measured memory_bytes: 896
using System;
using System.Collections.Generic;
class Program
{
	//static int[] dp;
	//static decimal[,,] dp;
	//static decimal N;
	static void Main(string[] args)
	{
			// 入力フェーズ
			int N = Int32.Parse(Console.ReadLine());
			//string[] input = Console.ReadLine().Split(' '); // K,X
			//int K = Int32.Parse(input[0]);
			//int X = Int32.Parse(input[1]);

// Nこの文字列を取得する→abc順に並び替えて辞書に入れる
			Dictionary<string, long> dict = new Dictionary<string, long>();
			//long ret = 0;
			//int[] alph = new int[26]; // -97
			for(int i=0; i<N; i++)
			{
				string str = Console.ReadLine();
				str = arrangeStr(str);
				if(dict.ContainsKey(str))
				{
					dict[str] = dict[str] + 1;
				}
				else
				{
					dict.Add(str, 1);
				}
			}
			long ret = 0;
			foreach(string key in dict.Keys)
			{
				long i = dict[key];
				ret += i*(i-1)/2;
			}
			Console.WriteLine(ret + "");
    }

		static string arrangeStr(string str)
		{
			int[] alph = new int[26]; // -97
			for(int i=0; i<10; i++)
			{
				int c = (int)str[i];
				alph[c-97]++;
			}
			string ret="";
			for(int i=0; i<26; i++)
			{
				int j = alph[i];
				for(int k=0; k<j; k++)
				{
					ret = ret + (char)(i+97);
				}
			}
			return ret;
		}

}


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

int main(){
    int n;
    cin >> n;
    map<string,int> mp;
    rep(i,n){
        string s;
        cin >> s;
        mp[s]++;
    }
    int mx = 0;
    for(auto p:mp){
        mx = max(p.second,mx);
    }
    vector<string> res;
    for(auto p:mp){
        if(p.second == mx) res.push_back(p.first);
    }
    sort(res.begin(),res.end());
    for(string s : res){
        cout << s << endl;
    }
    return 0;
}

Measured memory_bytes: 26996
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
 
const ll nmax = 1e9 + 7;
const ll Mod = 998244353;
const double PI = 2 * asin(1);

int Calc(int num){
  int cnt = 0;
  while (num > 0){
    num /= 2; cnt++;
  }
  return cnt++;
}

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

  int N = Calc(L), M = 0;
  int Pow[N] = {}, Sum[N] = {};
  Pow[N - 2] = 1; Sum[N - 2] = 1;
  for (int i = N - 3; i >= 0; i--){
    Pow[i] = Pow[i + 1] * 2;
    Sum[i] = Sum[i + 1] + Pow[i];
  }
  
  vector <Pii> Ans[N];
  for (int i = 0; i < N - 1; i++){
    Ans[i].push_back(make_pair(i + 1, 0));
    Ans[i].push_back(make_pair(i + 1, Pow[i]));
    M += 2;
  }
  
  int now = Pow[0] * 2;
  for (int i = 0; i < N; i++){
    if (now + Sum[i] + 1 <= L){
      Ans[0].push_back(make_pair(i, now));
      now += Sum[i] + 1;
      M++;
    }
  }
  
  cout << N << " " << M << endl;

  for (int i = 0; i < N; i++){
    for (int j = 0; j < Ans[i].size(); j++){
      cout << i + 1 << " ";
      cout << Ans[i][j].first + 1 << " " << Ans[i][j].second << endl;
    }
  }
  
  return 0;
}


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


const int Interval = 512;
struct SqrtDecomp{
  typedef long long Type;
  const int n;
  vector<Type> arr,buc;
  const Type ide;

  Type func(Type a,Type b){
    return a + b;
  }

  Type update_func(Type a,Type x){
    return a + x;
  }
SqrtDecomp(const vector<Type>& init,const Type& ide_) : n(init.size()),ide(ide_),arr(init),buc((int)init.size() / Interval + 10,ide_){ for(int i = 0;i < n;i++){ buc[i / Interval] = func(buc[i / Interval],arr[i]);
    }
  }

  Type get_inter(int l,int r){
    Type res = ide;
    while(l < r){
      if(l % Interval == 0 && l + Interval <= r){
        res = func(res , buc[l / Interval]);
        l += Interval;
      }
      else{
        res = func(res , arr[l]);
        l++;
      }
    }
    return res;
  }

  void update(int idx,const Type& x){
    arr[idx] = update_func(arr[idx] , x);
    buc[idx / Interval] = ide;
    int start = idx - idx % Interval;
    int end = min(start + Interval , (int)arr.size());
    for(int i = start;i < end;i++){
      buc[idx / Interval] = func(buc[idx / Interval],arr[i]);
    }
  }
};
#include <bits/stdc++.h>
using namespace std;
typedef long long i64;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()
int main(){
  int n,q;
  cin >> n >> q;
  SqrtDecomp srd(vector<i64>(n,0),0);
  vector<i64> ans;
  for(int i = 0;i < q;i++){
    i64 com,x,y;
    cin >> com >> x >> y;
    x--;
    if(com == 0){
      srd.update(x,y);
    }
    else{
      ans.push_back(srd.get_inter(x,y));
    }
  }

  for(int i = 0;i < ans.size();i++){
    cout << ans[i] << endl;
  }
}



Measured memory_bytes: 4516
#include <iostream>

using namespace std;

long long N,M;

int main(){
    long long c;
    cin >> N >> M;
    if(2*N>=M){
        cout << M/2 << endl;
        return 0; 
    }
    c = N;
    M -= 2*N;
    cout << N + M/4 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase

/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-7;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
double dis(double ax,double ay,double bx,double by){return (ax-bx)*(ax-bx)+(ay-by)*(ay-by);}
int count_num(vector<double>&zX,vector<double>&zY,double x,double y){
	int i,n,ans=0;n=zX.size();
	for(i=0;i<n;i++){
		if(dis(zX[i],zY[i],x,y)<=1+eps){ans++;}
	}
	return ans;
}
bool solve(void){
	int i,j,n,ans=0;cin>>n;
	if(n==0){return false;}
	vector<double>zX(n);
	vector<double>zY(n);
	for(i=0;i<n;i++){cin>>zX[i]>>zY[i];}
	for(i=0;i<n;i++){maxeq(ans,count_num(zX,zY,zX[i],zY[i]));}
	for(i=0;i<n;i++){
		for(j=i+1;j<n;j++){
			double kyo=sqrt(dis(zX[i],zY[i],zX[j],zY[j]));
			if(kyo>=2){continue;}
			double cx=(zX[i]+zX[j])/2;
			double cy=(zY[i]+zY[j])/2;
			double wari=sqrt(4-kyo*kyo)/kyo;
			maxeq(ans,count_num(zX,zY,cx+wari*(cy-zY[i]),cy-wari*(cx-zX[i])));
			maxeq(ans,count_num(zX,zY,cx-wari*(cy-zY[i]),cy+wari*(cx-zX[i])));
		}
	}
	cout<<ans<<endl;
	return true;
}
int main(void){
	while(solve()){}
	return 0;
}



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

using namespace std;

typedef long long ll;

const int __SIZE = 1 << 18;
char ibuf[__SIZE], *iS, *iT;

#define ge (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS++)) : *iS++)
#define ri read_int()
#define rl read_ll()
#define FILE(s) freopen(s"in", "r", stdin), freopen(s"out", "w", stdout)

template<typename T>
inline void read(T &x) {
	char ch, t = 0; x = 0;
	while(!isdigit(ch = ge)) t |= ch == '-';
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = ge;
	x = t ? -x : x;
}
inline int read_int() { int x; return read(x), x; }
inline ll read_ll() { ll x; return read(x), x; }

template<typename T>
inline void chkmin(T&a, T b) { a = a < b ? a : b; }

const int mod = 1e9 + 7;

int s[1010][1010];

struct Node {
	int a, b, c;

	Node() {}
	Node(int a, int b, int c):a(a), b(b), c(c) {}

	friend Node operator * (Node a, Node b) {
		Node c;
		c.a = 1LL * a.a * b.a % mod;
		c.b = (1LL * a.a * b.b + 1LL * a.b * b.c) % mod;
		c.c = 1LL * a.c * b.c % mod;
		return c;
	}
};

inline Node ksm(Node a, ll k) {
	Node s(1, 0, 1);
	while(k) {
		if(k & 1) s = s * a;
		a = a * a, k >>= 1;
	} return s;
}

inline int fsp(int x, ll k) {
	int s = 1;
	while(k) {
		if(k & 1) s = 1LL * s * x % mod;
		x = 1LL * x * x % mod, k >>= 1;
	}
	return s;
}

int main() {
#ifdef LOCAL
	FILE("");
#endif
	int n = ri, m = ri; ll k = rl;
	if(!k) return puts("1"), 0;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++) {
			char c = ge;
			while(c != '.' && c != '#') c = ge;
			s[i][j] = c == '#';
		}
	int ud = 0, lr = 0, c = 0, UD = 0, LR = 0;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++) {
			c += s[i][j];
			if(i == 1) UD += s[1][j] && s[n][j];
			else ud += s[i][j] && s[i - 1][j];
			if(j == 1) LR += s[i][1] && s[i][m];
			else lr += s[i][j] && s[i][j - 1];
		}
	if(!UD && !LR) printf("%d\n", fsp(c, k - 1));
	else if(UD && LR) puts("1");
	else {
		Node f;
		if(UD) f = ksm(Node(c, ud, UD), k - 1);
		else f = ksm(Node(c, lr, LR), k - 1);
		printf("%d\n", (f.a - f.b + mod) % mod);
	}
	return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

int dp[1 << 15][15];
int D[15][15];
const int INF = (int)1e7;

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int V, E; cin >> V >> E;
  REP(state, 1 << V) REP(i, V) dp[state][i] = INF;
  REP(i, V) REP(j, V) D[i][j] = INF;
  REP(i, E) {
    int s, t, d; cin >> s >> t >> d;
    D[s][t] = d;
  }

  dp[(1 << V) - 1][0] = 0;
  for (int state = (1 << V) - 2; state >= 0; state--) {
    REP(i, V) REP(j, V) if (not (state >> j & 1)) dp[state][i] = min(dp[state][i], dp[state | (1 << j)][j] + D[i][j]);
  }

  cout << (dp[0][0] == INF ? -1 : dp[0][0]) << endl;
  return 0;
}

Measured memory_bytes: 5080
#include<bits/stdc++.h>
#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 MST(a,x) memset(a,x,sizeof(a))
#define DEBUG cout<<"shllhs"<<endl;
#define ll long long
#define PB push_back
#define PH push
#define MP make_pair
#define FT first
#define SD second
#define N 2105
#define M 20
#define INF 100000000000000007
#define MOD 1000000007
#define MOD2 1000000009
#define eps 1e-10
#define pi acos(-1.0)
using namespace std;
string s;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin>>s)
    {
        int a[4];
        MST(a,0);
        for(auto u:s)
        {
            if(u == 'N')a[0] = 1;
            if(u == 'S')a[1] = 1;
            if(u == 'W')a[2] = 1;
            if(u == 'E')a[3] = 1;
        }
        int f = 0;
        if(a[0]!=a[1])f = 1;
        if(a[2]!=a[3])f = 1;
        if(f)cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
N,A,B,C,D = map(lambda x: int(x)-1,input().split())
S = input()

def obs(st,end):
  for i in range(st,end):
  	if S[i] is "#" and S[i+1] is "#": return True
  return False

if obs(B,D) or obs(A,C):
  print("No")
elif C > D:
  b = False
  for i in range(B-1,min(D,N-2)):
    if S[i] is "." and S[i+1] is "." and S[i+2] is ".":
      b = True
      break
  if b:
    print("Yes")
  else:
    print("No")
else:
  print("Yes")


    
  

Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
long long fac(ll a){
    long long ans=1;
    while(a>1){
        ans*=a;
        ans%=1000000007;
        a--;
    }
    return ans;
}
int main(){
    int n,m;
    cin >> n >> m;
    vvl v(n);
    rep(i,m){
        ll a,b;
        cin >> a >> b;
        v[a-1].push_back(b-1);
        v[b-1].push_back(a-1);
    }
    vl info(n);
    ll ans=0;
    rep(i,n)info[i]=i;
    while(info[0]==0){
        int count=0;
        for(int i=0;i<n-1;i++){
            for(int j=0;j<v[info[i]].size();j++){
                if(info[i+1]==v[info[i]][j])count++;
            }
        }
        if(count==n-1)ans++;
        next_permutation(all(info));
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
int main( void )
{
    int W, H, x, y, r;
    std::cin >> W >> H >> x >> y >> r;
    if ( ( ( x - r ) < 0 ) || ( ( x + r ) > W )
        || ( ( y - r ) < 0 ) || ( ( y + r ) > H ) )
    {
        std::cout << "No" << std::endl;
    }
    else
    {
        std::cout << "Yes" << std::endl;
    }
    
    return 0;
}

Measured memory_bytes: 3116
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <bitset>
#include <cstdint>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 h, w;
vector<string> s;
i64 di[] = { 1, 1, 0, -1, -1, -1, 0, 1 },
    dj[] = { 0, -1, -1, -1, 0, 1, 1, 1 };
int main() {
  cin >> h >> w;
  read_n(s, h);

  for (i64 i = 0; i < h; ++i) {
    for (i64 j = 0; j < w; ++j) {
      if (s[i][j] == '.') {
        s[i][j] = '0';
        for (i64 k = 0; k < 8; ++k) {
          i64 ti = i + di[k], tj = j + dj[k];
          if (0 <= ti && ti < h && 0 <= tj && tj < w && s[ti][tj] == '#') {
            s[i][j]++;
          }
        }
      }
    }
  }

  for (const auto& t : s) cout << t << '\n';
  return 0;
}



Measured memory_bytes: 256