akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

static const double eps = 10e-6;

struct edge{
	int idx;
	int dist;
	int num;
};

class info{
public:
	double val;
	vector<int> route;
	info() : val(10000000.0){}
};

double calcCost(int S,int n,int u,int v,const vector<edge>& Edge){
	double w=0;
	for(int i=0;i<n;i++){
		if(S & (1<<i)){
			w+=(double)Edge[i].num*20.0;
		}
	}

	double velocity = 2000.0/(70.0+(double)w);
	double dist = abs(Edge[v].dist - Edge[u].dist);

	return dist/velocity;
}


int main(){
	int n;
	scanf("%d",&n);

	info **dp = new info*[(1<<n)];
	for(int i=0;i<=(1<<n)-1;i++) dp[i] = new info[n];

	vector<edge> Edge;

	for(int i=0;i<n;i++){
		int idx,dist,num;
		scanf("%d %d %d",&idx,&dist,&num);
		edge e;
		e.dist = dist;
		e.idx = idx;
		e.num = num;
		Edge.push_back(e);
	}

	for(int i=0;i<n;i++){
		dp[1<<i][i].val = 0;
		dp[1<<i][i].route.push_back(i);
	}

	for(int S=0;S<=(1<<n)-1;S++){
		//from u
		for(int u=0;u<n;u++){
			if(!(S & (1<<u))) continue;
			//to v
			for(int v=0;v<n;v++){
				if(S & (1<<v)) continue;
				double val;
				if(dp[S|(1<<v)][v].val > (val = (dp[S][u].val + calcCost(S,n,u,v,Edge)))){
					dp[S|(1<<v)][v].val = val;
					dp[S|(1<<v)][v].route = dp[S][u].route;
					dp[S|(1<<v)][v].route.push_back(v);
				}
			}
		}
	}

	int min_idx;
	double minv=10000000.0;
	for(int i=0;i<n;i++){
		if(dp[(1<<n)-1][i].val < minv){
			minv = dp[(1<<n)-1][i].val;
			min_idx = i;
		}
	}

	for(int i=0;i<dp[(1<<n)-1][min_idx].route.size();i++){
		printf("%d%s",Edge[dp[(1<<n)-1][min_idx].route[i]].idx,i == dp[(1<<n)-1][min_idx].route.size() - 1 ? "\n" : " ");
	}

	for(int i=0;i<=(1<<n)-1;i++) delete[] dp[i];
	delete[] dp;

}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>

int main()
{
    int n, tmp, min = 2000000000, maxprofit = -1000000000;

    std::cin >> n;

    for ( int i = 0; i < n; ++i ) {
        std::cin >> tmp;
        maxprofit = std::max( maxprofit, tmp - min );
        min = std::min( min, tmp );
    }

    std::cout << maxprofit << std::endl;
}

Measured memory_bytes: 1164
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
  int a,b,c,d,e;
   while(scanf("%d,%d,%d,%d,%d",&a,&b,&c,&d,&e)==5) {
     vector<int> v;
     
     v.push_back(a);
     v.push_back(b);
     v.push_back(c);
     v.push_back(d);
     v.push_back(e);
     sort(ALL(v));

     int aa = count(ALL(v),v[0]);
     int bb = count(ALL(v),v[1]);
     int cc = count(ALL(v),v[2]);
     int dd = count(ALL(v),v[3]);
     
     if (aa == 4 || bb == 4) {
       cout << "four card" << endl;
     } else if (aa==3&&dd==2||aa==2&&cc==3){
       cout << "full house" << endl;
     } else if (v[0]+1==v[1]&&v[1]+1==v[2]&&v[2]+1==v[3]&&v[3]+1==v[4]) {
       cout << "straight" << endl;
     } else if (v[0]==1&&v[1]==10&&v[2]==11&&v[3]==12&&v[4]==13) {
       cout << "straight" << endl;
     } else if (aa==3||bb==3||cc==3) {
       cout << "three card" << endl;
     } else if (aa==2&&cc==2||aa==2&&dd==2||bb==2&&dd==2) {
       cout << "two pair" << endl;
     } else if (aa==2||bb==2||cc==2||dd==2) {
       cout << "one pair" << endl;
     } else
       cout << "null" << endl;
   }

}

Measured memory_bytes: 0
K=int(input())
ans=0
def gcd(a,b):#最大公約数を返す。Euclid
    if a<b:
        a,b=b,a
    c=a%b
    if c==0:
        return b
    return gcd(b,c)
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            d=gcd(i,j)
            ans+=gcd(d,k)
print(ans)


Measured memory_bytes: 78016
#include <iostream>
#include <string>
#include <vector>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  int count = 0;

  if (A == B && B == C) { // do nothing
  } else {
    int mx = std::max(std::max(A, B), C);
    count += (mx - A) / 2;
    A += (mx - A) / 2 * 2;
    count += (mx - B) / 2;
    B += (mx - B) / 2 * 2;
    count += (mx - C) / 2;
    C += (mx - C) / 2 * 2;

    if (A == B && B == C) { // do nothing
    } else if (A == B || B == C || C == A) {
      if (A + B + C == 3 * mx - 1) count += 2;
      else count++;
    } else {
      count++;
    }
  }

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,m;
int e;
vvi data;

//DFS
vector<vector<pair<int, int>>> g;
const int N = 1e5;
int used[N];
int col[N];

int dfs(int i, int c,int num) {
  if(used[i]) return 0;
  used[i] = 1;
  
  for(auto to : g[i]) {
    if (to.first==c){
      e=1;
      data[to.second].emplace_back(num);
      break;
    }else{
      e=dfs(to.first, c,num);
      if (e==1){
        data[to.second].emplace_back(num);
        break;
      }
    }
  }

  return e;
}




int main() {
  cin>>n;
  g.resize(n);
  for(int i = 0; i < n-1; i++) {
    int a, b;
    cin >> a >> b ;
    a--; b--;
    g[a].emplace_back(b, i);
    g[b].emplace_back(a, i);
  }

  cin>>m;
  vi u(m),v(m);
  REP(i,m){
    cin>>u[i]>>v[i];
    u[i]--;
    v[i]--;
  }

  
  //
  data.resize(50*20*2);
  REP(i,m){
    e=0;
    REP(j,50){used[j]=0;}
    e=dfs(u[i], v[i],i);
  }

  /*
  cout<<endl;
  REP(i,50){
    cout<<i<<" ";
    REP(j,data[i].size()){
      cout<<data[i][j]<<" ";
    }
    cout<<endl;
      
    
  }
  */

  ll ans=0LL;
  //1乗のやつを計算
  vi numm1(20);
  vvi numm2;
  numm2.resize(50*n);

  REP(i,n-1){
    REP(j,data[i].size()){
      numm1[data[i][j]]++;
      numm2[data[i][j]].emplace_back(i);
    }
  }

  /*
  REP(i,20){
    if (numm1[i]!=0){
      ans+=1LL<<((n-1)-numm1[i]);
    }
  }
  */

  //2乗のやつを計算
  //vvi ddata(20, vi(50,-1));//mi番目の通る道


  
  REP(i,1<<m){
    vi v(m);
    ll flag=0;
    REP(j,m){
      v[j]=(i>>j)%2;
      flag+=v[j];
    }
    flag%=2;

    vi tabl(n-1,0);
    REP(j,m){
      if (v[j]==1){
        for(int k=0;k<numm2[j].size();k++){
          tabl[numm2[j][k]]=1;
        }
      }
      int sm=0;
      for(int k=0;k<n-1;k++){
        sm+=tabl[k];
      }
      ans+=(1LL<<(n-1-sm))*(flag*2LL-1LL);
    }

  }
/*

  REP(i,50){
    REP(j,data[i].size()){
      for(int k=j+1;k<data[i].size();k++){
        tabl[data[i][j]*20+data[i][k]]++;
        tabl[data[i][k]*20+data[i][j]]++;
      }
    }
  }


  ll cnt=0;
  ll cnt1=0;
  REP(i,20){
    for(int j=i+1;j<20;j++){
      if ((numm1[i]!=0)&(numm1[j]!=0)){
        
        
        cnt=tabl[i*20+j];
        cnt1=numm1[i]+numm1[j]-cnt;
        ans-=(1LL<<(n-1-cnt1))*( (1LL<<(numm1[i]-cnt))+(1LL<<(numm1[j]-cnt)) -2LL);
      }
    }
  }
*/
  //cout<<ans<<endl;


  //ans=(1LL<<(n-1))-ans;

  cout<<-ans<<endl;
  return 0;
}

/*
3
1 2
2 3
2
1 3
2 3
*/

Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
int N;
ll K;
ll Memo[100005]; // gcdがidxのときの場合の和
map<int, ll> M;

ll calc_npow(ll num) {
  ll tmp =1ll;
  rep(i, N) {
    tmp*=num;
    tmp%=MOD;
  }
  return tmp;
}

void init() {
  rep(i, K) M[K/(i+1)]=-1;
  for (auto p: M) M[p.first] = calc_npow(p.first);
} 

void calc(ll num) {
  ll cnt = M[K/num];
  ll idx=2ll;
  while(num*idx<=K) {
    cnt-=Memo[num*idx];
    cnt%=MOD;
    idx++;
  }
  if (cnt<0) cnt+=MOD;
  Memo[num] =cnt;
}

int main() {
  INCANT;
  cin >> N >> K;
  init();
  for(ll i=K; i>=1; i--) calc(i);
  ll ans =0ll;
  rep(i, K) {
    ans+=Memo[i+1]*ll(i+1);
    ans%=MOD;
  }
  if (ans<0) ans+=MOD;
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 4432
N = int(input())
A = str(input())
B = str(input())
C = str(input())
count = 0
for i in range(0,N,1):
  if (A[i] != B[i] and A[i] != C[i] and B[i] != C[i]):
    count += 2
  elif (A[i] == B[i] and A[i] != C[i]) or \
       (A[i] == C[i] and A[i] != B[i]) or \
       (B[i] == C[i] and A[i] != B[i]):
    count += 1
print(count)

Measured memory_bytes: 3064
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
  bool prime[100000];
  prime[0]=prime[1]=0;
  loop(i,2,100000){
    prime[i]=true;
  }
  for(int i=2;i<=100000;i++){
    for(int j=2;i*j<=100000;j++){
      prime[i*j]=false;
    }
  }
  int n,m,ans1,ans2;
  while(cin>>n,n){
    for(int i=2;i<=n;i++){
      if(prime[i]){
	m=i;
	i++;
	while(!prime[i])i++;
	if(i>n)break;
	if((i-m)==2){
	  ans1=m;
	  ans2=i;
	}
	i--;
      }
    }
    cout<<ans1<<" "<<ans2<<endl;
  }
  return 0;
}

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

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}

#define PRINT_VECTOR_MAX 100
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)min(v.size(),PRINT_VECTOR_MAX); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)min(v.size(),PRINT_VECTOR_MAX); i++) {for (ll j = 0; j < (ll)min(v[i].size(),PRINT_VECTOR_MAX); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

void Main();
int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	Main();
	return 0;
}

void Main(){
    int n; cin >> n;
    ll ans = 0;
    for(int a = 1; a < n; a++){
        int b = (n-1) / a;
        ans += (ll)b;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int MAX=1e5 + 10,MOD=1e9 + 7;
int N,K,A[105],mn=1e9;
int dp[MAX][2];
int f(int rem,int turn)
{
    if(rem<mn&&turn==1)return 0;
    if(rem<mn&&turn==0)return 1;
    if(dp[rem][turn]!=-1)return dp[rem][turn];
    for(int i=0;i<N;i++)
    {
        if(rem-A[i]>=0)
        if(f(rem-A[i],turn^1)==turn){
            return dp[rem][turn] = turn;
        }
    }
    return dp[rem][turn] = turn^1;
}
int main ()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    memset(dp,-1,sizeof dp);
    cin >> N >> K;
    for(int i=0;i<N;i++){cin>>A[i];mn = min(mn,A[i]);}
    if(f(K,0)==0){
        cout<<"First\n";
    }
    else cout<<"Second\n";
    //main();
    return 0;
}


Measured memory_bytes: 8832
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

ll n,m;
ll fa[MAXn],in[MAXn];
vector<ll> e[MAXn];
int main(){
  IOS();
  cin >> n >> m;
  REP (i,n+m-1) {
    ll u,v;
    cin >> u >> v;
    e[u].eb(v);
    in[v]++;
  }

  queue<ll> q;
  REP (i,n) if (!in[i]) q.push(i);
  while (SZ(q)) {
    ll cur = q.front();
    q.pop();
    for (auto it:e[cur]) {
      debug(cur,it);
      in[it]--;
      if (!in[it]) {
        fa[it] = cur;
        q.push(it);
      }
    }
  }

  REP1 (i,n) cout << fa[i] << endl;
}


Measured memory_bytes: 7808
#include <bits/stdc++.h>
using namespace std;
 
#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define INFINITO 1000000000
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )

#define MAX 100005

bool p[MAX];


void sieve() {
    memset(p, true, sizeof(p));
    for ( int i = 2; i * i < MAX; i++ ) {
        if ( p[i] ) {
            for ( int j = i * i; j <= MAX; j += i ) p[j] = false;
        }
    }
}


int main() {

    int x;
    cin >> x;
    sieve();

    while ( !p[x] ) x++;
    cout << x << endl;

    return 0;
}

Measured memory_bytes: 384
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Console.ReadLine();
            var a = 0;
            foreach(char i in n)
            {
                a += int.Parse(i.ToString());
            }
            if (a % 9 == 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 32828
from math import sqrt
n=input()
for i in range(n):
	x1,y1,x2,y2,x3,y3=map(float,raw_input().split())
	A1=2*(x2-x1)
	B1=2*(y2-y1)
	C1=x2**2+y2**2-x1**2-y1**2
	A2=2*(x3-x2)
	B2=2*(y3-y2)
	C2=x3**2+y3**2-x2**2-y2**2
	x=(C1*B2-C2*B1)/(A1*B2-A2*B1)
	y=(A1*C2-A2*C1)/(A1*B2-A2*B1)
	R=sqrt((x1-x)**2+(y1-y)**2)
	print"%.3f %.3f %.3f"%(x,y,R)

Measured memory_bytes: 6408
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
 int A,B;
 cin>>A>>B;
 
 int one = max(A,B);

 if(one==A)
 A -=1;
 else
 B -=1;

 int two = max(A,B);

 if(two==A)
 cout<< one + two <<endl;
 else 
 cout<< one + two <<endl;
  }


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <tuple>
#include <stack>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
using namespace std;
const int INF = 1e9;
typedef long long lint;
const lint LINF = 1e18;
const lint MOD = 1e9 + 7;
// const lint MOD = 998244353;
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
char upper(char c){
	return c-0x20;
}
char lower(char c){
	return c+0x20;
}

int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}
 
int main() {
	string a,b; cin>>a>>b;
	map<char, char> mp1, mp2;
	rep(i,a.size()){
		mp1[a[i]] = b[i];
		mp2[b[i]] = a[i];
	}
	rep(i,a.size()){
		if (mp1[a[i]] != b[i] || mp2[b[i]] != a[i]){
			print("No");
			return 0;
		}
	}
	print("Yes");
}


Measured memory_bytes: 776
import sys
readline = sys.stdin.readline
write = sys.stdout.write

N = int(input())
edges = [[] for i in range(N)]
for i in range(N-1):
    a, b = map(int,readline().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)
C = list(map(int, readline().split()))
C.sort()
print(str(sum(C)-C[-1]))

queue = [0]
D = ["x" for i in range(N)]
while queue:
    op = queue.pop(0)
    if D[op] != "x":
        continue
    D[op] = str(C.pop(-1))
    numchild = len(edges[op])
    for i in range(numchild):
        queue.append(edges[op][i])
print((' '.join(D)))

Measured memory_bytes: 44784
N=int(input())
T=list(map(int,input().split()))
M=int(input())
P=[0]*M
X=[0]*M
for i in range(M):
  P[i],X[i]=map(int,input().split())
T_sum=sum(T)

for j in range(M):
  #print(j,P[j],X[j],T[P[j]-1])
  if P[j] <=N:
    diff = T[P[j]-1] - X[j]
  else:
    diff=0
  print(T_sum - diff)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#define _USE_MATH_DEFINES
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
double mysqrt(double x) {
	double l = 0, r = x;
	for (int i = 0; i < 64; ++i) {
		double m = (l + r) / 2.0;
		if (m*m < x)l = m;
		else r = m;
	}
	return l;
}
///////////////////////////////////////

int main() {
	int n; cin >> n;
	ll a[200100];
	vector <ll> sum = { 0 };
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		sum.push_back({ sum.back() + a[i] });
	}
	sort(sum.begin(), sum.end());
	map < ll , ll > key;
	for (int i = 0; i <= n; ++i) {
		key[sum[i]]++;
	}
	ll ans = 0;
	for (auto v : key) {
		ans += (v.second - 1)*v.second / 2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 15856
// ProblemURL : https://atcoder.jp/contests/abc080/tasks/abc080_d
// ---------------------------------------------
package main

import (
	"fmt"
	"sort"
)

const inf = 1 << 60

func chmax(a *int, b int) {
	if *a < b {
		*a = b
	}
}

type program struct{ s, t, c int }
type byCS []program          //
func (p byCS) Len() int      { return len(p) }
func (p byCS) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
func (p byCS) Less(i, j int) bool {
	if p[i].c == p[j].c {
		return p[i].s < p[j].s
	}
	return p[i].c < p[j].c
}

func main() {
	var n, c int
	fmt.Scan(&n, &c)

	a := make([]program, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i].s, &a[i].t, &a[i].c)
	}
	sort.Sort(byCS(a))
	b := make([]program, 0, n)
	a = append(a, program{s: inf, t: inf, c: inf}) // 番兵
	for i := 0; i < n; i++ {
		p := program{s: a[i].s, t: a[i].t, c: a[i].c}
		for i < n && p.c == a[i+1].c && p.t == a[i+1].s {
			p.t = a[i+1].t
			i++
		}
		b = append(b, p)
	}

	maxTime := int(1e5)
	imos := make([]int, maxTime+1)
	for i := range b {
		imos[b[i].s-1]++
		imos[b[i].t]--
	}
	for i := 1; i < len(imos); i++ {
		imos[i] += imos[i-1]
	}

	mx := -1
	for i := range imos {
		chmax(&mx, imos[i])
	}
	fmt.Println(mx)
}


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

int main() {
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;

  char c1 = toupper(s1[0]);
  char c2 = toupper(s2[0]);
  char c3 = toupper(s3[0]);
  
  cout << c1 << c2 << c3 << endl;  

  return 0;
}


Measured memory_bytes: 3584
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
int main(int argc, char const *argv[])
{
    int N;
    scanf("%i", &N);

    long long sum = 0;
    long long max = 0;
    for (int i = 0; i < N; i++)
    {
        long long tmp;
        scanf("%lld", &tmp);
        if (tmp < max)
        {
            sum += max - tmp;
        }
        if (tmp > max)
        {

            max = tmp;
        }
    }
    printf("%lld\n", sum);
    return 0;
}


Measured memory_bytes: 1732
import java.util.*;

class Main {

   public static void main(String[] args) {
       new Solver().run();
   }

}


class Solver {

    private boolean isPrime(long n) {
        if (n == 0 || n == 1) return false;
        if (n == 2) return true;

        if (n % 2 == 0) return false;

        for (long i = 3; i * i <= n; i+=2) {
            if (n % i == 0) return false; 
        }   
        return true;
    } 

 
    private boolean isLikely2017(int n) {
        if (n == 2) return false;
        return isPrime(n) && isPrime((n + 1) / 2);
    }

    public void run() {
        Scanner sc = new Scanner(System.in);
        int Q = sc.nextInt();
        int[] l = new int[Q];
        int[] r = new int[Q];
        for (int i = 0; i < Q; i++) {
            l[i] = sc.nextInt();
            r[i] = sc.nextInt();
        }

        int[] S = new int[100002];
        S[0] = 0;
        for (int i = 1; i < 100002; i++) {
            if (isLikely2017(i)) {
                S[i] = S[i - 1] + 1;
            } else {
                S[i] = S[i - 1];
            }
        }

        //for (int i = 0; i < 10; i++) {
        //    System.out.println(String.format("S[%d]=%d ", i, S[i]) + isPrime(i));
        //}


        for (int i = 0; i < Q; i++) {
           int ans  = S[r[i] + 1] - S[l[i] - 1];
           System.out.println(ans);
        }


    }
}

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

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

int h, w, n, sx, sy;
char s[N], t[N];

int f(int x, int b, char l, char r){
	int c = x;
	for(int i = 0; i < n; i++){
		if(s[i] == l) c--;
		if(c <= 0) return 1;
		if(t[i] == r) c = min(b, c + 1);
	}
	c = x;
	for(int i = 0; i < n; i++){
		if(s[i] == r) c++;
		if(c > b) return 1;
		if(t[i] == l) c = max(1, c - 1);
	}
	return 0;
}

int main(){
	scanf("%d%d%d%d%d%s%s", &h, &w, &n, &sx, &sy, s, t);
	if(f(sx, h, 'U', 'D') || f(sy, w, 'L', 'R')) puts("NO");
	else puts("YES");
}

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

int main(){
    int n;
    cin >> n;
    int A[n];
    for (int i = 0; i < n; i++){
        cin >> A[i];
    }
    sort(A, A+n);

    for (int i = 0; i < n; i++){
        if(A[i] == A[i+1]){
            cout << "NO" << endl;
            return 0;
        }   
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 1024
using System;

public class hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var wmax = int.Parse(line[1]);
        var p = new int[n];
        var w = new int[n];
        var dp = new int[n + 1, wmax+1];
        for (int i = 0; i < n + 1; i++)
            for (int j = 0; j < wmax + 1; j++)
                dp[i, j] = -1;
        for (int i = 0; i < n; i++)
        {
            string[] line2 = Console.ReadLine().Trim().Split(' ');
            p[i] = int.Parse(line2[0]);
            w[i] = int.Parse(line2[1]);
        }
        var ans = Rec(0, wmax, n, w, p ,dp);
        Console.WriteLine(ans);
   }
    public static int Rec (int i, int j  , int n  , int[] w,  int[] p  ,int[,] dp)
    {
        if (dp[i, j] != -1) return dp[i, j];
        if (i == n) {  return 0; }
        if (j < w[i])
        {
            var t1 = Rec(i + 1, j, n, w, p, dp);
            if (dp[i + 1, j] == -1) dp[i + 1, j] = t1;
            return t1;
        }
        else
        {
            var comp1 = Rec(i + 1, j, n, w, p ,dp  );
            if (dp[i + 1, j] == -1) dp[i + 1, j] = comp1;
            var comp2 = Rec(i + 1, j - w[i], n, w, p ,dp) + p[i];
            if (dp[i + 1, j-w[i]] == -1) dp[i + 1, j-w[i]] = comp2 - p[i];
            return Math.Max(comp1, comp2);
        }
    }
}

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

int main() {
	string str[3];
	int index[2];
	index[1] = 0;
	cin >> str[0] >> str[1] >> str[2];
	while (1) {
		index[0] = index[1];
		if (str[index[0]].length() == 0) {
			break;
		}
		index[1] = (str[index[0]][0] - 'a');
		str[index[0]].erase(str[index[0]].begin());
	}
	cout << (char)('A' + index[0]) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mt make_tuple
#define mp make_pair
#define pu push_back
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-6
#define ll long long int
#define ld long double
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define pr(v) { for(int i=0;i<v.size();i++) { v[i]==INF? cout<<"INF " : cout<<v[i]<<" "; } cout<<endl;}
#define t1(x)                cerr<<#x<<" : "<<x<<endl
#define t2(x, y)             cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl
#define t3(x, y, z)          cerr<<#x<<" : " <<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl
#define t4(a,b,c,d)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<endl
#define t5(a,b,c,d,e)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<endl
#define t6(a,b,c,d,e,f)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<" "<<#f<<" : "<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define _ cerr<<"here"<<endl;
#define __ {ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}

using namespace std;
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){ return out<<"("<<a.first<<", "<<a.second<<")";}
template <int> ostream& operator<<(ostream& os, const vector<int>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { if(v[i]!=INF) os << v[i]; else os << "INF";if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; ;if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 


int main()
{
  __;
  ld a,b,c;
  cin >> a >> b >> c;
  // if(a+b-c < 0) cout << "No" << endl;
  if(a + b + 2*sqrtl(a)*sqrtl(b) < c) cout << "Yes" << endl;
  else cout << "No" << endl;
  // cout << (a+b-c)/2.0 << endl;
  // if( ((a+b-c))/2.0 < sqrtl(a*b)) cout << "Yes" << endl;
  // else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
vvi cnt(30);
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll ans=0;
  string s,t;cin>>s>>t;
  ll n=s.size(),m=t.size();
  ll kuri=0;
  for(int i=0;i<n;i++)
    cnt[s[i]-'a'].pb(i);
  for(int i=0;i<30;i++){
    cnt[i].pb(llINF);
  }
  ll now=-1;
  for(int i=0;i<m;i++){
    char c=t[i];
    ll po=c-'a';
    if(cnt[po].size()==1){cout<<-1<<endl;return 0;}
    if(cnt[po][cnt[po].size()-2]>now){
      auto lb=upper_bound(ALL(cnt[po]),now);
      now=*lb;
    }else{
      kuri++;
      now=cnt[po][0];
    }
  }
  cout<<now+n*kuri+1<<endl;
  return 0;
}

Measured memory_bytes: 1736
#-*-coding:utf-8-*-

def main():
    x = int(input())
    ans = 0
    interest = 100
    while True:
        interest = int(interest * 0.01 + interest)
        ans += 1
        if interest >= x:
            print(ans)
            exit()
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 9176
#include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pii;

int main(){
	int l,a,b,c,d,x,y;
	cin>>l>>a>>b>>c>>d;
	x=(a%c)?a/c+1:a/c;
	y=(b%d)?b/d+1:b/d;
	o(l-max(x,y));
}

Measured memory_bytes: 1164
N,M=map(int,input().split())
table=[]
for i in range(M):
    x,y=map(int,input().split())
    table.append((x-1,y-1))
F=[False]*N
F[0]=True
L=[1]*N
for x,y in table:
    L[x]-=1
    L[y]+=1
    if F[x]:
        F[y]=True
    if L[x]==0:
        F[x]=False
    #print(L)
    #print(F)
print(sum(F))  

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

int main() {
  string S;
  cin >> S;
  int a = S.size();
  bool flag = false;
  for (int i = 0; i < a - 1; i++){
    if (i % 2 == 1) continue;
    if (S[i] == 'h' && S[i + 1] == 'i') flag = true;
  }
  if (flag == true && a % 2 == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3624
import sys
input = sys.stdin.readline

n, m = [int(x) for x in input().split()]
g = [[] for _ in range(n)]

for _ in range(m):
    l, r, d = [int(x) for x in input().split()]
    g[l - 1].append((r - 1, d))
    g[r - 1].append((l - 1, -d))

d = [None] * n
visited = [0] * n

for i in range(n):
    if visited[i] != 0:
        continue
    stack = [i]
    d[i] = 1
    while stack:
        u = stack.pop()
        visited[u] = 1
        for v, d_ in g[u]:
            if d[v] is None:
                d[v] = d[u] + d_
                stack.append(v)
            else:
                if d[v] != d[u] + d_:
                    print("No")
                    sys.exit()
print("Yes")


Measured memory_bytes: 66684
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define CTOI(x) (x - 'A') 
#define ctoi(x) (x - 'a')
#define BIT(x) (1 << (x))
using namespace std;

LL modinv(LL a){
    LL b = MOD, u = 1, v = 0;
    while(b){
        LL t = a / b;
        a -= t * b;swap(a, b);
        u -= t * v;swap(u, v);
    }
    u%=MOD;
    if(u < 0) u += MOD;
    return u;
}

LL exp(LL a, LL b){
    LL res = 1;
    LL sum = a;
    while(b){
        if(b&1)res = (res * sum) % MOD;
        sum = (sum * sum) % MOD;
        b>>=1;
    }
    return res;
}

class modint{
public:   
    int a;
    modint():a(0){}
    modint(int b):a(b){}
    modint& operator=(int b){
        a = b;
        if(a<0)a = (a + (-a + MOD - 1) / MOD * MOD)%MOD;
    }
    operator int() const{
        return a;
    }
};

istream& operator>>(istream& in, modint&m){
    in >> m.a;
    if(m.a < 0){
        m.a = (m.a + (-m.a + MOD - 1) / MOD * MOD) % MOD;
    }
    return in;
}

ostream& operator<<(ostream& out, modint m){
    out << m.a;
    return out;
}

modint operator+(const modint&a, const modint&b){
    modint res;
    res.a = (a.a + b.a) % MOD;
    return res;
}

modint operator-(const modint&a, const modint&b){
    modint res;
    res.a = (a.a - b.a + MOD) % MOD;
    return res;
}

modint operator*(const modint&a, const modint&b){
    LL c = (LL)a.a * b.a % MOD;
    modint res;
    res.a = c;
    return res;
}

modint operator/(const modint&a, const modint&b){
    LL c = b.a;
    LL d = MOD;
    LL u = 1, v = 0;
    while(d){
        LL t = c / d;
        c -= t * d;swap(c, d);
        u -= t * v;swap(u, v);
    }
    u%=MOD;
    if(u < 0) u += MOD;
    modint res;
    res = ((LL)a.a * u) % MOD;
    return res;
}

int n;
map<int, vector<int> > m;
vector<int> color;
vector<modint> dp;

modint func(int place){
    if(place == n){
        return 1;
    }
    if(dp[place]>=0)return dp[place];
    modint res;
    res = 0;
    if(upper_bound(ALL(m[color[place]]), place) != m[color[place]].end()){
        res = res + func(*upper_bound(ALL(m[color[place]]), place));
    }
    res = res + func(place + 1);
    return dp[place] = res;
}

int main(){
    cin >> n;
    dp.resize(n, -1);
    int bc = -1;
    int count = 0;
    REP(i, n){
        int d;
        cin >> d;
        if(d != bc){
            color.push_back(d);
            m[d].push_back(count++);
            bc = d;
        }
    }
    n = count;
    cout << func(0) << endl;
    return 0;
}


Measured memory_bytes: 42484
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <unordered_map>
using namespace std;

int main() {
  int N, D, X;
  vector<int> A;
  cin >> N >> D >> X;
  for (int i = 0; i < N; i++) {int tmp; cin >> tmp; A.push_back(tmp); }

  int total = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < D; j += A[i])
      total += 1;
  }
  cout << total + X << endl;
}


Measured memory_bytes: 256
H, W = map(int, input().split())
a = [list(input()) for _ in range(H)]

x = 0
y = 0
ans = 'Possible'
a[0][0] = '.'
while True:
    if y < W - 1 and a[x][y + 1] == '#':
        y += 1
        a[x][y] = '.'
        continue
    elif x < H - 1 and a[x + 1][y] == '#':
        x += 1
        a[x][y] = '.'
        continue
    break

for i in range(H):
    if a[i].count('#') != 0:
        ans = 'Impossible'
        break
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int main(){
  int N;
  cin>>N;
  vector<string> S(N);
  rep(i,N) cin>>S[i];

  map<string,ll> mp;
  ll ans=0;
  for(int i=0;i<N;i++){
    sort(S[i].begin(),S[i].end());
    ans+=mp[S[i]];
    mp[S[i]]++;
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 18176
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            int N = intArray[0];
            int R = intArray[1];
            if(10 <= N)
            {
                Console.WriteLine(R);
            }
            else
            {
                Console.WriteLine(R + 100 * (10 - N));
            }
        }
    }
}

//文字配列の取得
//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];

//文字列の取得
//string s = Console.ReadLine();

//数字配列の取得
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];

//数字の取得
//int N = int.Parse(Console.ReadLine());

//リスト型(int)の取得
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());

//出力
//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.WriteLine(cnt);



Measured memory_bytes: 28264
#include <stdio.h>
int main(void){
  char S[100];
  scanf("%s",S);
  
  int len;
  len=(int)strlen(S)-1;
  int i,count=0;
  for(i=0; i<len; i++){
    if(S[i]!=S[len]) count++;
    len--;
  }
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 128
use std::io;
use std::str;
use std::usize;
use std::cmp;


fn main() {
    let (n, m) = {
        let v = read_values::<usize>();
        (v[0], v[1])
    };
    let a = (0..n).map(|_| {
        read_values::<usize>()
    }).collect::<Vec<_>>();

    let mut min = n;
    let mut alive = vec![true; m];
    for _ in 0..(m - 1) {
        let mut count = vec![0; m];
        for i in 0..n {
            for j in 0..m {
                let sport = a[i][j] - 1;
                if alive[sport] {
                    count[sport] += 1;
                    break;
                }
            }
        }

        let mut max = 0;
        for i in 0..m {
            max = cmp::max(max, count[i]);
        }
        min = cmp::min(min, max);
        for i in 0..m {
            if count[i] == max {
                alive[i] = false;
                break;
            }
        }
    }

    println!("{}", min);
}

fn read_line() -> String {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).unwrap();
    buf
}

fn read_values<T>() -> Vec<T>
    where T: std::str::FromStr,
          T::Err: std::fmt::Debug
{
    read_line()
        .split(' ')
        .map(|a| a.trim().parse().unwrap())
        .collect()
}

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

int main() {
  int A,B,C;
  cin >> A >> B >> C;
  int gcd;
  for (int i=1; i<101; i++) {
    if (A%i == 0 && B%i == 0) {
      gcd = i;
    }
  }
  if (C%gcd == 0) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
using namespace std;

int main(void)
{
  int h, w;
  scanf("%d %d", &h, &w);
  char s[200][200];
  char m[200][200];
  for ( int i=0; i<h; i++ ) {
    scanf("%s", s[i]);
  }
  for ( int i=0; i<h; i++ ) {
    for ( int j=0; j<w; j++ ) {
      int t = 0;
      if ( s[i][j] == '#' ) {
        m[i][j] = '#';
        continue;
      }
      for ( int k1=-1; k1<=1; k1++ ) {
        for ( int k2=-1; k2<=1; k2++ ) {
          if ( i+k1 < 0 || i+k1 >= h || j+k2 < 0 || j+k2 >= w ) { continue; }
          if ( s[i+k1][j+k2] == '#' ) { t++; }
        }
      }
      m[i][j] = '0' + t;
    }
  }

  for ( int i=0; i<h; i++ ) {
    printf("%s\n", m[i]);
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstdint>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<string>> S(H, vector<string>(W));
    rep(i, H) rep(j, W) cin >> S[i][j];
    rep(i, H) rep(j, W) {
        if(S[i][j] == "snuke") {
            cout << (char)(j + 'A') << i + 1 << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

const mod int = 1000000007

func main() {
	var N, M, r int
	fmt.Scan(&N, &M)

	diff := Abs(N - M)
	if diff >= 2 {
		fmt.Println(0)
		return
	}
	w := make([]int, 100010)
	w[1] = 1
	for i := 2; i < len(w); i++ {
		w[i] = (w[i-1] * i) % mod
	}
	r = (w[N] * w[M]) % mod
	if diff == 0 {
		r = (r * 2) % mod
	}
	fmt.Println(r)
}
func Abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <iomanip>

using namespace std;

#define sz(a) static_cast<int>((a).size())
#define f first
#define s second
#define els(v) for (auto &el : (v))


#ifdef KIRYA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) {
    cerr << _s << " = " << _h << "\n";
}

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;

    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;

    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

const int64_t INF = static_cast<int64_t>(1e9) + 7;
const int64_t LINF = INF * INF;
const int MAXN = static_cast<int>(1e6) + 17;



void solve() {
    int n, k;
    cin >> n >> k;
    int64_t cur = 0;
    vector<int> p(n);
    int64_t ans = 0;
    for (int i = 0; i < n; ++i) {
        cin >> p[i];
        ++p[i];
        cur += p[i];
        if (i >= k) {
            cur -= p[i - k];
        }
        ans = max(ans, cur);
    }
    cout << setprecision(10) << static_cast<double>(ans) / 2 << '\n';
}

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

    int q = 1;

    for (int i = 0; i < q; ++i) {
        solve();
    }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b>=c) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template<typename T>inline void read(T &x){
	short f=1;x=0;char c=getchar();
	while(!isdigit(c)){ if(c=='-')f=-1;c=getchar(); }
	while(isdigit(c)) x=(x<<3)+(x<<1)+(c^48),c=getchar();
	x*=f;
}
template<typename T>inline void write(T x){
	if(x<0)putchar('-'),x=-x;
	if(x>9)write(x/10);
	putchar(x%10+'0');
}
template<typename T>inline void writeln(T x){
	write(x);putchar('\n');
}
int main(){
	int n,l;
	string s[110];
	read(n),read(l);
	for(int i=1;i<=n;i++)cin>>s[i];
	sort(s+1,s+n+1);
	for(int i=1;i<=n;i++)cout<<s[i];
	putchar('\n');
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

const int N=200010,P=1e9+7;

int n,m,a,b,fac[N],inv[N];

inline void Pre(){
  fac[0]=1; for(int i=1;i<=200000;i++) fac[i]=1LL*fac[i-1]*i%P;
  inv[1]=1; for(int i=2;i<=200000;i++) inv[i]=1LL*(P-P/i)*inv[P%i]%P;
  inv[0]=1; for(int i=1;i<=200000;i++) inv[i]=1LL*inv[i-1]*inv[i]%P;
}

inline int C(int x,int y){
  return 1LL*fac[x]*inv[y]%P*inv[x-y]%P;
}

int main(){
  cin>>n>>m>>a>>b; Pre();
  int ans=C(n+m-2,n-1);
  for(int i=1;i<=b;i++)
    ans=(ans-1LL*C(n-a+i-2,n-a-1)*C(a-1+m-i,m-i))%P;
  ans=(ans+P)%P;
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <stack>

using namespace std;

int main(void){
	int n;

	cin >> n;
	for(int i=0;i<n;i++){
		int ball;
		stack<int> b,c;
		bool put=true;

		for(int j=0;j<10;j++){
			cin >> ball;
			if(put){
				if(b.empty()||b.top()<ball)
					b.push(ball);
				else if(c.empty()||c.top()<ball)
					c.push(ball);
				else
					put=false;
			}
		}
		cout << (put?"YES":"NO") << endl;
	}
}

Measured memory_bytes: 1192
import std.stdio, std.string, std.array, std.conv, std.numeric;

int arrayLCM(int[] x) {
    while (x.length > 1) {
        int a = x[0];
        int b = x[1];
        int r = gcd(a, b);
        x[1] = a * b / r;
        x = x[1..$];
    }
    return x[0];
}

void main() {
    int n = readln.chomp.to!int;
    int[] a = readln.chomp.split.to!(int[]);
    arrayLCM(a).writeln;
}


Measured memory_bytes: 2500
#pragma GCC optimize("O3")
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using ull=unsigned long long int;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
while(1){
  int d;
  cin>>d;
  if(d==0)return 0;
  multiset<P> dat;
  for(int i=0;i<d;i++){
    string s,t;
    cin>>s>>t;
    ll a=0,b=0;
    ll n=ll(s[0]-'0'),m=ll(t[0]-'0');
    n*=10;m*=10;
    n+=ll(s[1]-'0'),m+=ll(t[1]-'0');
    a+=3600*n,b+=3600*m;
    n=0,m=0;
    n+=ll(s[3]-'0'),m+=ll(t[3]-'0');
    n*=10;m*=10;
    n+=ll(s[4]-'0'),m+=ll(t[4]-'0');
    a+=60*n,b+=60*m;
    n=0,m=0;
    n+=ll(s[6]-'0'),m+=ll(t[6]-'0');
    n*=10;m*=10;
    n+=ll(s[7]-'0'),m+=ll(t[7]-'0');
    a+=n;b+=m;
    dat.insert({a,b});
  }
  int ans=0;
  while(dat.size()){
    ll bfo=-1;
    ans++;
    for(auto ite=dat.begin();ite!=dat.end();){
      if(bfo<=(*ite).fi){
        bfo=(*ite).se;
        ite=dat.erase(ite);
      }else ite++;
    }
  }
  cout<<ans<<"\n";
}
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a, b, c, n; cin >> a >> b >> c >> n;
    ll ans = -linf;
    rep(i, n+1) rep(j, n+1) {
        ll k = n - (i + j);
        if (k < 0) continue;
        chmax(ans, (a<<i) + (b<<j) + (c<<k));
    }
    cout << ans << endl;
}


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

int main() {
    int n;
    cin>>n;
    set<string> s;
    for(int i=0;i<n;i++)
    {
        string k;
        cin>>k;
        s.insert(k);
    }
    cout<<s.size()<<endl;
    return 0;
}

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

typedef long long int ll;

#define endl '\n'

ll n;
ll arr[31][31];

ll dp[31][(1LL<<22)];
ll mod = 1e9+7;
ll solve(ll u,ll mask){


    if(u==n){
        return 1;
    }

    if(dp[u][mask]==-1)
    {
        ll val = 0;
        for(ll i=0;i<n;i++){
            if(arr[u][i]==1){
                if(((mask>>i)&1)==0){
                    val = (val+solve(u+1,mask+(1LL<<i)))%mod;
                }
            }
        }
        dp[u][mask] = val;
    }
    return dp[u][mask];

}

int main()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    memset(dp,-1,sizeof(dp));
    cin>>n;

    for(ll i=0;i<n;i++){
        for(ll j=0;j<n;j++){
            cin>>arr[i][j];
        }
    }

    cout<<solve(0,0);
}


Measured memory_bytes: 1016192